Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>1) Why handle your button listener with an implementation of View.OnClickListener?</p> <p>The standard way I have seen so far is:</p> <pre><code> Button01.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Your code } }); </code></pre> <p>2) Notifications are ways to notify the user through the Android status panel at the top of the screen. I don't understand what you want to do with Notifications and Dialog Boxes - make up your mind which one you want?</p> <p><a href="http://developer.android.com/guide/topics/ui/dialogs.html" rel="nofollow">http://developer.android.com/guide/topics/ui/dialogs.html</a></p> <p><a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html" rel="nofollow">http://developer.android.com/guide/topics/ui/notifiers/notifications.html</a></p> <p>If you do want to use Notifications, then this is what I have in my <code>onStop()</code> method (it's basically just what you get from following the Android guide):</p> <pre><code> Notification notification = new Notification(R.drawable.icon, "App Name", System.currentTimeMillis()); notification.flags = Notification.FLAG_AUTO_CANCEL; Intent notificationIntent = new Intent(this, ClassToStart.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(getApplicationContext(), "App Name", "Press here to resume", contentIntent); mNotificationManager.notify(1, notification); </code></pre> <p>This is with <code>mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);</code> already done in <code>onCreate()</code></p> <p>Really not sure what it is you're trying to do. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload