summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Gilles Debunne <debunne@google.com> 2010-09-09 09:21:53 -0700
committer Gilles Debunne <debunne@google.com> 2010-09-09 09:21:53 -0700
commit6e1df0e981c8c588e411b8ad6e55554fe4815655 (patch)
treec8677e46c2e2d7bb61a592d96f951e5463e0948d
parent1604ae64564ff088a46efbc072c68024bfc8325f (diff)
Progress Dialog documentation example uses onPrepareDialog
Change-Id: I7afebdb321e28d8e4b1687ba4f503bde7d6031a0
-rw-r--r--docs/html/guide/topics/ui/dialogs.jd17
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java2
2 files changed, 12 insertions, 7 deletions
diff --git a/docs/html/guide/topics/ui/dialogs.jd b/docs/html/guide/topics/ui/dialogs.jd
index 74b544bb985a..d047b2d57753 100644
--- a/docs/html/guide/topics/ui/dialogs.jd
+++ b/docs/html/guide/topics/ui/dialogs.jd
@@ -472,18 +472,25 @@ public class NotificationTest extends Activity {
progressDialog = new ProgressDialog(NotificationTest.this);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setMessage("Loading...");
- progressThread = new ProgressThread(handler);
- progressThread.start();
return progressDialog;
default:
return null;
}
}
+ @Override
+ protected void onPrepareDialog(int id, Dialog dialog) {
+ switch(id) {
+ case PROGRESS_DIALOG:
+ progressDialog.setProgress(0);
+ progressThread = new ProgressThread(handler);
+ progressThread.start();
+ }
+
// Define the Handler that receives messages from the thread and update the progress
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
- int total = msg.getData().getInt("total");
+ int total = msg.arg1;
progressDialog.setProgress(total);
if (total >= 100){
dismissDialog(PROGRESS_DIALOG);
@@ -514,9 +521,7 @@ public class NotificationTest extends Activity {
Log.e("ERROR", "Thread Interrupted");
}
Message msg = mHandler.obtainMessage();
- Bundle b = new Bundle();
- b.putInt("total", total);
- msg.setData(b);
+ msg.arg1 = total;
mHandler.sendMessage(msg);
total++;
}
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 5dbbd70d2802..dc21a721a894 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -83,7 +83,7 @@ public class BitmapFactory {
/**
* The pixel density to use for the bitmap. This will always result
* in the returned bitmap having a density set for it (see
- * {@link Bitmap#setDensity(int) Bitmap.setDensity(int))}. In addition,
+ * {@link Bitmap#setDensity(int) Bitmap.setDensity(int)}). In addition,
* if {@link #inScaled} is set (which it is by default} and this
* density does not match {@link #inTargetDensity}, then the bitmap
* will be scaled to the target density before being returned.