Android:show list of data in notification -
i data json , save in sqlite eith for
,i want when each data save in db make notification data
my for
for(int i=0;i<jnews.length();i++){ jsonobject c = jnews.getjsonobject(i); string id = c.getstring(tag_id); string title = c.getstring(tag_onvan); string text = c.getstring(tag_matn); string data = c.getstring(tag_tarikh); string nid = c.getstring(tag_cnid); hashmap<string,string> nnews = new hashmap<string,string>(); nnews.put(tag_id,id); nnews.put(tag_onvan,title); nnews.put(tag_matn,text); nnews.put(tag_tarikh,data); nnews.put(tag_cnid,nid); newslist.add(nnews); db.setnewnews(id, title, text, data, nid); }
i use code in for
,but not good
string ns = context.notification_service; notificationmanager mnotificationmanager = (notificationmanager) getsystemservice(ns); int icon = r.drawable.ic_launcher; charsequence tickertext = "ثبت اختراع"; // ticker-text long when = system.currenttimemillis(); context context = getapplicationcontext(); charsequence contenttitle = title; charsequence contenttext = title + data; intent notificationintent = new intent(this, newsactivity.class); pendingintent contentintent = pendingintent.getactivity(this, 0, notificationintent, 0); notification notification = new notification(icon, tickertext, when); notification.setlatesteventinfo(context, contenttitle, contenttext, contentintent); mnotificationmanager.notify(i, notification);
i want show in 1 notification,not this
check below link information appending text notification builder.
Comments
Post a Comment