I am saving the imae from drawing canvas.
It takes some seconds to geting save to the sdcard.
So, During the process of save i want to show the dialog that the Image getting save…
So how to implement the progress dialog for that ?
The code for Image save is as like below:
case R.id.saveBtn:
Toast.makeText(getApplicationContext(), "Save", Toast.LENGTH_SHORT).show();
final Activity currentActivity = this;
Handler saveHandler = new Handler(){
@Override
public void handleMessage(Message msg) {
final AlertDialog alertDialog = new AlertDialog.Builder(currentActivity).create();
alertDialog.setTitle("Drawing App");
alertDialog.setMessage("Your drawing had been saved :)");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alertDialog.show();
}
} ;
new ExportBitmapToFile(this,saveHandler, drawingSurface.getBitmap()).execute();
break;
Since you are using
AsyncTask(ExportBitmapToFile) you can callProgressDialoginpreExecute()and dismiss it inpostExecutemethod. There are noHandlers required to do this.edit