I have a slightly strange problem. When the action starts, I show a dialog that says that some elements are loaded as follows:
Dialog dialog; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.topic_edit); dialog = new Dialog (this); dialog.setContentView(R.layout.please_wait); dialog.setTitle("Loading The Comment."); TextView text = (TextView) dialog.findViewById(R.id.please_wait_text); text.setText("Please wait while the comment loads..."); dialog.show();
I declare a dialog box before declaring the class, and then whenever I try to reject it using dialog.dismiss(); It does not close.
Here you go_wait.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/please_wait_text" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </RelativeLayout>
Does anyone know why the dialog doesn't close on dialog.dismiss() ... I'm trying to fire in an asynchronous call after the call. But I checked, and the dialog.dismiss() is executed, for some reason does not close the dialog.
This is how I try to reject the dialog:
@Override protected void onPostExecute(String result) { dialog.dismiss(); }
source share