Need Help on Creating a ProgressDialog in Android?
Hai dudes, Cany an开发者_JAVA百科yone tell me how to Create a ProgressDialog in Android?
See the below code if this helps you..
//progress bar
final ProgressDialog progress_dialog = new ProgressDialog(DialogboxExample.this);
progress_dialog.setMessage("Loading please wait..");
progress_dialog.setCancelable(true);
Button btnprogress = (Button) findViewById(R.id.button3);
btnprogress.setOnClickListener(new OnClickListener(){
public void onClick(View v)
{
progress_dialog.show();
}
});
//progress bar percentage wise
final ProgressDialog progress_dialog2;
progress_dialog2 = new ProgressDialog(this);
progress_dialog2.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progress_dialog2.setMessage("Loeading..");
progress_dialog2.incrementProgressBy(10);
//progress_dialog2.setProgress(100);
progress_dialog2.setCancelable(true);
Button btnprogress2 = (Button) findViewById(R.id.button4);
btnprogress2.setOnClickListener(new OnClickListener(){
public void onClick(View v)
{ progress_dialog2.show();}
});
Come on try to think first! http://developer.android.com/guide/topics/ui/dialogs.html#ProgressDialog
精彩评论