- ProgressDialog does not disappear after executing dismiss, hide or cancel?
- public class LODOverlay extends Overlay implements OnClickListener {
- private Dialog overlayDialog;
- private ProgressDialog progressDialog;
- ..............
- @Override
- public void onClick(View view) {
- .......
- final Context ctx = view.getContext();
- this.progressDialog = new ProgressDialog(ctx);
- ListView lv = new ListView(ctx);
- ArrayAdapter<String> adapter = new ArrayAdapter<String>(ctx, R.layout.layerlist, names);
- lv.setAdapter(adapter);
- final LODOverlay obj = this;
- lv.setOnItemClickListener(new OnItemClickListener() {
- public void onItemClick(AdapterView<?> parent, View view,
- int position, long id) {
- String name = ((TextView) view).getText().toString();
- Intent getFloorIntent = new Intent(Map.RENDERER);
- getFloorIntent.putExtra("type", "onGetBuildingLayer");
- getFloorIntent.putExtra("id", name);
- view.getContext().sendBroadcast(getFloorIntent);
- overlayDialog.dismiss();
- obj.waitingForLayer = name;
- progressDialog.show(ctx, "Loading...", "Wait!!!");
- }
- });
- .......
- }
- public void buildingLoaded(String id) {
- if (null != this.progressDialog) {
- if (id.equals(this.waitingForLayer)) {
- this.progressDialog.hide();
- this.progressDialog.dismiss();
- ............
- Map.flipper.showNext(); // changes the view
- }
- }
- }
- public static ProgressDialog show (Context context, CharSequence title, CharSequence message)
- progressDialog.setTitle("Loading...");
- progressDialog.setMessage("Wait!!!");
- progressDialog.show();
- progressDialog = ProgressDialog.show(ctx, "Loading...", "Wait!!!");
- public static ProgressDialog show(Context context, CharSequence title,
- CharSequence message, boolean indeterminate,
- boolean cancelable, OnCancelListener cancelListener) {
- ProgressDialog dialog = new ProgressDialog(context);
- dialog.setTitle(title);
- dialog.setMessage(message);
- dialog.setIndeterminate(indeterminate);
- dialog.setCancelable(cancelable);
- dialog.setOnCancelListener(cancelListener);
- dialog.show();
- return dialog;
- }