Thursday, September 22, 2011

Android Progress Dialog Example



package co.cc;

import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.Bundle;

public class AsyntaskActivity extends Activity {
protected static final int LOADING_DIALOG = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
showDialog(LOADING_DIALOG);
}
protected Dialog onCreateDialog(int id) {
if(id == LOADING_DIALOG){
ProgressDialog loadingDialog = new ProgressDialog(this);
loadingDialog.setMessage("Loading records ...");
loadingDialog.setIndeterminate(true);
loadingDialog.setCancelable(true);
return loadingDialog;
}
return super.onCreateDialog(id);
}
}



progress

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.