I get data from json and save in sqlite eith a for
,I want when each data save in db make a notification with this 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 this 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 all in one notification,Not like this