Merge "Doc Update: notification bug fix." into klp-docs
This commit is contained in:
committed by
Android (Google) Code Review
commit
fc8ea92df1
@@ -80,6 +80,7 @@ previous.link=expanded.html
|
|||||||
setProgress(0, 0, false)}. For example:
|
setProgress(0, 0, false)}. For example:
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
|
int id = 1;
|
||||||
...
|
...
|
||||||
mNotifyManager =
|
mNotifyManager =
|
||||||
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
@@ -100,7 +101,7 @@ new Thread(
|
|||||||
// state
|
// state
|
||||||
mBuilder.setProgress(100, incr, false);
|
mBuilder.setProgress(100, incr, false);
|
||||||
// Displays the progress bar for the first time.
|
// Displays the progress bar for the first time.
|
||||||
mNotifyManager.notify(0, mBuilder.build());
|
mNotifyManager.notify(id, mBuilder.build());
|
||||||
// Sleeps the thread, simulating an operation
|
// Sleeps the thread, simulating an operation
|
||||||
// that takes time
|
// that takes time
|
||||||
try {
|
try {
|
||||||
@@ -114,7 +115,7 @@ new Thread(
|
|||||||
mBuilder.setContentText("Download complete")
|
mBuilder.setContentText("Download complete")
|
||||||
// Removes the progress bar
|
// Removes the progress bar
|
||||||
.setProgress(0,0,false);
|
.setProgress(0,0,false);
|
||||||
mNotifyManager.notify(ID, mBuilder.build());
|
mNotifyManager.notify(id, mBuilder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Starts the thread by calling the run() method in its Runnable
|
// Starts the thread by calling the run() method in its Runnable
|
||||||
@@ -157,7 +158,7 @@ new Thread(
|
|||||||
// percentage, and "determinate" state
|
// percentage, and "determinate" state
|
||||||
mBuilder.setProgress(100, incr, false);
|
mBuilder.setProgress(100, incr, false);
|
||||||
// Issues the notification
|
// Issues the notification
|
||||||
mNotifyManager.notify(0, mBuilder.build());
|
mNotifyManager.notify(id, mBuilder.build());
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
Replace the lines you've found with the following lines. Notice that the third parameter
|
Replace the lines you've found with the following lines. Notice that the third parameter
|
||||||
@@ -169,7 +170,7 @@ mNotifyManager.notify(0, mBuilder.build());
|
|||||||
// Sets an activity indicator for an operation of indeterminate length
|
// Sets an activity indicator for an operation of indeterminate length
|
||||||
mBuilder.setProgress(0, 0, true);
|
mBuilder.setProgress(0, 0, true);
|
||||||
// Issues the notification
|
// Issues the notification
|
||||||
mNotifyManager.notify(0, mBuilder.build());
|
mNotifyManager.notify(id, mBuilder.build());
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
The resulting indicator is shown in figure 2:
|
The resulting indicator is shown in figure 2:
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ next.link=managing.html
|
|||||||
{@link android.app.Activity}. For example:
|
{@link android.app.Activity}. For example:
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
|
int id = 1;
|
||||||
...
|
...
|
||||||
Intent resultIntent = new Intent(this, ResultActivity.class);
|
Intent resultIntent = new Intent(this, ResultActivity.class);
|
||||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
|
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user