hi
as a part of application i need to notify the files downloaded
but when downloading the other file after one completed the
notification displayed is changing to the current download and the
notification for the before download is not displaying
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
public class Notify extends Activity {
private static final int NOTIFY_ID = 1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(ns);
int icon = R.drawable.icon; // icon from resources
CharSequence tickerText = "Hello"; // ticker-text
long when = System.currentTimeMillis(); //
notification time
Context context = getApplicationContext(); // application
Context
CharSequence contentTitle = "My notification"; // expanded
message title
CharSequence contentText = "Hello World!"; // expanded
message text
Intent notificationIntent = new Intent(this, Notify.class);
PendingIntent contentIntent = PendingIntent.getActivity(this,
0, notificationIntent, 0);
// the next two lines initialize the Notification, using the
configurations above
Notification notification = new Notification(icon, tickerText,
when);
notification.setLatestEventInfo(context, contentTitle,
contentText, contentIntent);
mNotificationManager.notify(NOTIFY_ID, notification);
}
}
this is the code
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en