Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.view.KeyEvent; import android.view.Window; public class Main { public static ProgressDialog showProgressDialog(Context context) { ProgressDialog myProgressDialog = new ProgressDialog(context); myProgressDialog.setMessage("Please wait..."); myProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); myProgressDialog.show(); myProgressDialog.setCancelable(false); myProgressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) { return true; } return false; } }); return myProgressDialog; } }