Problem with the popup/notification in Android? -


I have created an activity in which I have made a progress bar, and I have written the notification but it is not working . The notification is sometimes in the top corner of the screen. I need notification in the middle of the screen as a message box. How to achieve it? My activity code is as follows:

  Public class uses oddg activity OnClickListener {Progressive Dialog Dialog; Int incharge; Maximum max; Private Notification Manager Manager; Private static ending end APP_ID = 0; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); SetContentView (R.layout.main1); Button startbtn = (button) findViewById (R.id.startbtn); Startbtn.setOnClickListener (this); MManager = (Notification Manager) getSystemService (reference.NETIFICATION_SERVICE); } @ Override Public Zero (see Arg 0) {// Increase the value of the text box EditText et = (edit text) findViewById (R.id.increment); // Change the value of the text to an integer increment = integer.parseint (et. Tag). Dialog = new progress (this); Dialog.setCancelable (true); Dialog.setMessage ("Loading ..."); // Set progress for horizontal dialog .SetprogressSystem (Progress Dolog, STYLE_HORIZONTAL); // times reset to the default value of the dialog .setprogress (0); // Get the maximum value EditText max = (EditText) findViewById (R.id.maximum); // The value of the text is an integer maximum = integer. Change in ParseInt (max.getText (.) ToString ()); // Set maximum cost dialog .setMax (max); // Display the progress bar dialog. Show (); // progress bar thread to update the background to create a thread = new thread (new runnable) {run public {run (run)} {try to run the code while displaying progress bar. // This example only Progress bar of being incremented: // Until progress value reaches maximum value, while keeping current (dialog.getProgress () <= dialog.getMax ()) // wait between 500ms of each update Thread.Sleep (500); // Active Update Handler ProgressHandler.sendMessage (progressHandler.obtai NMessage ());}} Hold (java.lang.InterruptedException e) {// if something Something Smart}}} fails to do; // Background Thread Background Start Start (); } // Handler progressHandler = Background handler to update new handler {Public Zero handleMessage (Message msg) {if (dialog.getProgress () == dialog.getMax ()) {Notification Notification = New notification (R. Drawable icon, "click here", System.currentTimeMillis ()); Notification.setLatestEventInfo (oddg.this, "App Name", "Notification Details", PendingIntent.getActivity (getApplicationContext (), CONTEXT_IGNORE_SECURITY, getIntent (), CONTEXT_IGNORE_SECURITY)); } Dialog.increment progress (increment); }};    

Something like this

  notificationMgr = Context .getSystemService (reference .NETIFICATION_SERVICE); Pending Content ContentTent = Pending.teactivity (CTX, 0, New Intent (CTX, MyActClassnameClass), 0); Notification Notification = New Notification (Arrowable.con, Some Text, System. Content-time Mills ()); Notification.SetlatEventInfo (CTX, Title, ContentText, ContentInantent); Int HELLO_ID = 10; Information Manager Notice (HELLO_ID, Notification);   

Check this for status bar notification



Comments