Guest User

Untitled

a guest
Nov 14th, 2012
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. package com.disp;
  2.  
  3.  
  4. import android.app.Activity;
  5. import android.app.Notification;
  6. import android.app.NotificationManager;
  7. import android.content.Context;
  8. import android.os.Bundle;
  9. import android.os.SystemClock;
  10.  
  11. public class DispalyActivity extends Activity {
  12. @Override
  13. public void onCreate(Bundle savedInstanceState) {
  14. super.onCreate(savedInstanceState);
  15. setContentView(R.layout.main);
  16.  
  17. for (int i = 0; i < 100; i++) {
  18. SystemClock.sleep(300);
  19. displaymessage(""+i+"%");
  20.  
  21. }
  22. }
  23.  
  24. public void displaymessage(String string) {
  25. String ns = Context.NOTIFICATION_SERVICE;
  26. NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
  27. Notification notification = new Notification(R.drawable.ic_launcher, "Notification Service", System.currentTimeMillis());
  28. Context context = getApplicationContext();
  29. notification.setLatestEventInfo(context, "Downloading Content:", string, null);
  30. final int HELLO_ID = 2;
  31. mNotificationManager.notify(HELLO_ID, notification);
  32.  
  33. }
  34. }
Add Comment
Please, Sign In to add comment