[ProgressBar3.java]
public class ProgressBar3 extends Activity {
ProgressDialog mDialog1;
ProgressDialog mDialog2;
private static final int DIALOG1_KEY = 0;
private static final int DIALOG2_KEY = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.progressbar_3);
Button button = (Button) findViewById(R.id.showIndeterminate);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG1_KEY);
}
});
button = (Button) findViewById(R.id.showIndeterminateNoTitle);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG2_KEY);
}
});
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG1_KEY: {
ProgressDialog dialog = new ProgressDialog(this);
dialog.setTitle("Indeterminate");
dialog.setMessage("Please wait while loading...");
dialog.setIndeterminate(true);
dialog.setCancelable(true);
return dialog;
}
case DIALOG2_KEY: {
ProgressDialog dialog = new ProgressDialog(this);
dialog.setMessage("Please wait while loading...");
dialog.setIndeterminate(true);
dialog.setCancelable(true);
return dialog;
}
}
return null;
}
}
[progressbar_3.xml]
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/showIndeterminate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/progressbar_3_indeterminate" />
<Button android:id="@+id/showIndeterminateNoTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/progressbar_3_indeterminate_no_title" />
</LinearLayout>
'old > API_Demo' 카테고리의 다른 글
Views_RadioGroup (0) | 2010.05.06 |
---|---|
Views_ProgressBar_Dialogs (0) | 2010.05.06 |
Views_ProgressBar_Smooth (0) | 2010.05.06 |
Views_ProgressBar_Incremental (0) | 2010.05.06 |
Views_Lists_Efficient Adapter (0) | 2010.04.27 |