Android :: Preventing Dialog Auto-Dismiss On Button Click

Mar 20, 2010

Is there any way (the best way) to avoid this happening? I am using a ProgressDialog which has one cancel button. On clicking the cancel button I want to disable the cancel button and change the message to "Canceling...". That bit's easy. Only once the cancellation has been fully processed do I want to dismiss the dialog. The only way I can think of is to use a custom layout but I would rather keep the default dialog look and feel (rather than trying to simulate it with my own code).

Android :: Preventing Dialog Auto-Dismiss on Button Click


Android :: Dialog Goes Away On Click Of Search Button

Feb 25, 2010

I have an activity which starts with a progress bar and I do not want the progress bar to go away until the processing is done, I have set the dialog to be setCancelable(false) so now user cannot cancel it with back but there are several other situations which hides the dialog for eg pressing 'search'.On clicking of 'search' button the search box and keyboard pops up,back button hides it and shows my activity which is always in the background but the dialog is gone.I can disable the search button but ideally I would want dialog to come back when the activity comes in foreground again. Any ideas how to do it?

View 5 Replies View Related

Android :: Button On Custom Dialog Not Responding To Click Events

Oct 12, 2010

I created a custom dialog that extends Dialog. One button on that the dialog is an "OK" button which the user is expected to press when finished entering information in other fields. I cannot get any listeners set to that button to fire.

public class HeightDialog extends Dialog {

private Button okButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.heightdialog);
this.okButton = (Button)this.findViewById(R.id.userOkWithHeight);
this.okButton.setOnClickListener(new android.view.View.OnClickListener() {................

View 2 Replies View Related

Android :: Right Way To Dismiss Dialog

Dec 17, 2009

I am trying to use a managed dialog. I noticed that after the first time I display it, subsequent creations don't actually make a new instance of the dialog, they just seem to reuse the first one. If I want to stop that, and get a brand new instance on every call, is this the right way to do it?:

@Override
protected Dialog onCreateDialog(int id) { switch (id) { case MY_DIALOG_ID:
MyDlg dlg = new MyDlg(this);
dlg.setOnDismissListener(new OnDismissListener() {
public void onDismiss(DialogInterface dialog) {
removeDialog(MY_DIALOG_ID);
} } );
return dlg;
} return null;
}

So I guess the removeDialog() call does the trick, but my onDismiss() handler should be called in every instance of the dialog being killed, right (like Dialog.cancel(), Dialog.dismiss(), hitting the back key)?

View 1 Replies View Related

Android :: How To Dismiss Dialog?

Aug 5, 2010

AlertDialog.Builder fpdialog = new AlertDialog.Builder(context);
ListView fpathlist = new ListView(context);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,android.R.layout.simple_expandable_list_item_1, fpathdata());
OnItemClickListener listener = new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, final int position, long arg3) {
// TODO Auto-generated method stub for (int i=0;i<=position;i++) {
if (i==position) { CharSequence[] pathString ;
final AlertDialog.Builder pathlist = new AlertDialog.Builder(context);
pathlist.setTitle;
pathlist.setItems(pathString, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//Here I want to dismiss the fpdialog } } );
pathlist.show();
} } } };
fpathlist.setOnItemClickListener(listener);
fpathlist.setAdapter(adapter);
fpdialog.setView(fpathlist);
fpdialog.show();

View 2 Replies View Related

Android :: Dismiss Failed In Dialog

Aug 12, 2010

I would like to create my own DateTimePicker Dialog. Therefor I build a layout that I use in my Dialog. My Dialog starts when I click on a Button. When the Dialog opens you can set date and time data. There is still a Button to close the Dialog. This Button calls Dialog.dismiss(). But it fails. Here is some code. Can someone tell me, what I do wrong?

public class CreateActivity extends Activity{ private TextView mDateTimeDisplay;
private Dialog dateTimePicker;
private int mYear; private int mMonth; private int mDay; private int mHour; private int mMinute;
static final int DATE_DIALOG_ID = 0;
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(de.android.todo.R.layout.create);
//http://babukuma.com/2010/01/android-custom-component- datetimepicker_29.html
mDateTimeDisplay = (TextView) findViewById(R.id.dateTimeDisplay);
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH); mHour = c.get(Calendar.HOUR_OF_DAY);
mMinute = c.get(Calendar.MINUTE); dateTimePicker = new Dialog(this);
dateTimePicker.setContentView(R.layout.datetimepicker);
dateTimePicker.setTitle("DateTimePicker");
dateTimePicker.setCancelable(true);
DatePicker dp = (DatePicker) dateTimePicker.findViewById(R.id.datePicker);
dp.init(mYear, mMonth, mMonth, onDateChangedListener);
TimePicker tp = (TimePicker) dateTimePicker.findViewById(R.id.timePicker);
tp.setIs24HourView(true);
tp.setOnTimeChangedListener(onTimeChangedListener);
// display the current date updateDisplay();
} public void onClickShowMyDialog(final View v){ showDialog(DATE_DIALOG_ID);
} public void onClickCloseDialog(final View v){ dateTimePicker.dismiss();
} @Override protected Dialog onCreateDialog(int id) { switch (id) {
case DATE_DIALOG_ID: return dateTimePicker;
} return null;
}

View 2 Replies View Related

Android :: How To Dismiss Custom Dialog?

May 13, 2010

I'm trying to make a custom dialog to show a view in this dialog. This is the Builder code:

//Getting the layout LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_dialog_simple,(ViewGroup) findViewById(R.id.rlDialogSimple));
//Change Text and on click
TextView tvDialogSimple = (TextView) layout.findViewById(R.id.tvDialogSimple);
tvDialogSimple.setText(R.string.avisoComprobar);
Button btDialogSimple = (Button) layout.findViewById(R.id.btDialogSimple);
btDialogSimple.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//Do some stuff
//Here I want to close the dialog
} } );

AlertDialog.Builder builder = new AlertDialog.Builder(AcPanelEditor.this);
builder.setView(layout);
AlertDialog alert = builder.create();
alert.show();

So, I want to dismiss the dialog in the onClick of btDialogSimple. How I can do it? I don't know how to call the dismiss method from inside a onclicklistener. My buttons have a custom layout, so I don't want to make a builder.setPositiveButton.

View 1 Replies View Related

Android :: How To Dismiss Spinner Dialog Automatically?

Jul 30, 2009

I am sure that everybody can easily recur the problem I am facing. There is a Spinner in the view, which includes a few entries. When I click the Spinner, it pops up a dialog so user can choose an entry. All these are very normal and you can find such things in SDK's API demo. The problem is: when the dialog is still on focus, if you change the phone's orientation, an exception will be thrown. Something like this:
07-30 20:46:03.727: ERROR/WindowManager(416): Activity com.client.CommandList has leaked window
com.android.internal.policy.impl.PhoneWindow$DecorView@43116318 that was originally added here 07-30 20:46:03.727: ERROR/WindowManager(416): android.view.WindowLeaked:
Activity com.client.CommandList has leaked window
com.android.internal.policy.impl.PhoneWindow$DecorView@43116318 that was originally added here
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.ViewRoot.<init ViewRoot.java:214)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.Window$LocalWindowManager.addView(Window.java:392)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.app.Dialog.show(Dialog.java:231)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.widget.Spinner.performClick(Spinner.java:247)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.View.onTouchEvent(View.java:3828)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.View.dispatchTouchEvent(View.java:3368)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:831)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
07-30 20:46:03.727: ERROR/WindowManager(416): at com.android.internal.policy.impl.PhoneWindow $DecorView.superDispatchTouchEvent(PhoneWindow.java:1707)
07-30 20:46:03.727: ERROR/WindowManager(416): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1197) 07-30 20:46:03.727: ERROR/WindowManager(416): at android.app.Activity.dispatchTouchEvent(Activity.java:1993)
07-30 20:46:03.727: ERROR/WindowManager(416): at com.android.internal.policy.impl.PhoneWindow $DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.os.Handler.dispatchMessage(Handler.java:99)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.os.Looper.loop(Looper.java:123)
07-30 20:46:03.727: ERROR/WindowManager(416): at android.app.ActivityThread.main(ActivityThread.java:3948)
07-30 20:46:03.727: ERROR/WindowManager(416): at java.lang.reflect.Method.invokeNative(Native Method)
07-30 20:46:03.727: ERROR/WindowManager(416): at java.lang.reflect.Method.invoke(Method.java:521)
07-30 20:46:03.727: ERROR/WindowManager(416): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:782)
07-30 20:46:03.727: ERROR/WindowManager(416): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
07-30 20:46:03.727: ERROR/WindowManager(416): at dalvik.system.NativeStart.main(Native Method)

View 4 Replies View Related

Android :: Unable To Dismiss Progress Dialog

Nov 5, 2010

I've got a progress dialog that I'm unable to dismiss and I can't figure out why. The first time through the code, it shows the dialog and dismisses it perfectly. The second time through it fails to dismiss. There is no error in the logcat and no exceptions are thrown, but the dialog remains on the screen.

If I run the code a third time, while the dialog is on the screen, a window leak exception is shown in the logcat when the code attempts to show the dialog, which is pretty much what you'd expect. The showDialog is called right before I call the execute method of an AsyncTask and the dismissDialog is called in the onPostExecute method of that AsyncTask.

View 3 Replies View Related

Android :: Dismiss Dialog With Custom Layout

Aug 16, 2010

I have a dialog with a custom layout, and I try to close it when I press a button:
private void showAboutDialog() {
dialog = new Dialog(MainMenu.this);
dialog.setContentView(R.layout.about_dialog);
dialog.setCancelable(true);
dialog.setTitle(R.string.about_title);
dialog.show();

LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.about_dialog, (ViewGroup) findViewById(R.id.layout_root));
Button closeButton = (Button) layout.findViewById(R.id.about_close_button);
closeButton.setOnClickListener(new Button.OnClickListener() { public void onClick(View view) { dialog.dismiss();
} } );
}
But it doesn't work.

View 1 Replies View Related

Android :: How To Dismiss Single Select Dialog?

Mar 14, 2009

Thanks for your reminding me of that. JBQ. From the reference of SDK, AlertDialog information as below. I want to create a dialog but I don't want to have any buttons in the dialog, then I hope to dismiss the dialog after i click any item in the dialog, how should I dismiss the dialog? When the user click the "back" button, it will dismiss the dialog. So I need to send the key message in hard code? is there any other way?

public AlertDialog.Builder<http://developer.android.com/reference/android/app/AlertDialog.Builde...>
setSingleChoiceItems (CharSequence[]<http://developer.android.com/reference/java/lang/CharSequence.html>items, int checkedItem, DialogInterface.OnClickListener
<http://developer.android.com/reference/android/content/DialogInterfac...>listener)

Set a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. The list will have a check mark displayed to the right of the text for the checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a button will dismiss the dialog. Parameters items the items to be displayed. Checked Item specifies which item is checked. If -1 no items are checked. listener notified when an item on the list is clicked. The dialog will not be dismissed when an item is clicked. It will only be dismissed if clicked on a button, if no buttons are supplied it's up to the user to dismiss the dialog.

View 5 Replies View Related

Android :: How To Dismiss Dialog After Clicking Any Item?

Mar 15, 2009

From the reference of SDK, AlertDialog information as below. I want to create a dialog but I don't want to have any buttons in the dialog, then I hope to dismiss the dialog after I click any item in the dialog, how should I dismiss the dialog ? When the user click the "back" button, it will dismiss the dialog. So I need to send the key message in hard code? Is there any other way?
public AlertDialog.Builder<http://developer.android.com/reference/android/app/AlertDialog.Builde...>
setSingleChoiceItems (CharSequence[]<http://developer.android.com/reference/java/lang/CharSequence.html>items,
int checkedItem, DialogInterface.OnClickListener<http://developer.android.com/reference/android/content/DialogInterfac...>listener)

Set a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. The list will have a check mark displayed to the right of the text for the checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a button will dismiss the dialog. Parameters items the items to be displayed. Checked Item specifies which item is checked. If -1 no items are checked. Listener notified when an item on the list is clicked. The dialog will not be dismissed when an item is clicked. It will only be dismissed if clicked on a button, if no buttons are supplied it's up to the user to dismiss.

View 3 Replies View Related

Android :: How To Make My Progress Dialog Dismiss After Webview Loaded?

Jul 19, 2010

What do I need to my code to make the dialog dismiss() after the webview is loaded?

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new homeClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.loadUrl("http://google.com");
ProgressDialog pd = ProgressDialog.show(Home.this, "", "Loading. Please wait...", true);
}
I've tried
public void onPageFinshed(WebView view, String url){ pd.dismiss();
}
Didn't work.

View 3 Replies View Related

Android : Progress Dialog Went Back To First View Called It When Dismiss

Nov 3, 2009

I have a weird problem on progress dialog: I have 2 views: Login View and say, Display View. In Login View, when I click the 'Login' button, a progress dialog is created (new ProgressDialog(...)), shown and stored in a variable 'mProgressDialog'. After login, the dialog is dismissed and some information are displayed in Display View (Login View hides). Now I want to display another progress dialog when 'Update' button is clicked and when the update is done, dismiss the dialog and display new information. So I use: the Display View for a blink and then shows the Login View. I tried to change the view etc. but same problem happens over and over again. So I am thinking it might because one activity can only be assigned to ONE progress dialog and no matter how you re-create it you still get the same progress dialog. And the dialog is linked to a certain view which will be shown automatically when the dialog dismisses.

View 8 Replies View Related

General :: Preventing Apps From Auto Starting

Sep 19, 2011

I use the app called "System" and it lists about a dozen apps that are stored in my cache or that are using memory when I have not innitiaited the service or app...

I'm most familiar with computers so I'll relate it to that; is there some type of command line that I can use to stop some of these apps from auto start and being stored. For instance on windows you can 'msconfig' what programs are allowed to start on boot up.

Here is a list of apps that I want to stop: AccuWeather.com, Android Booster, Google Voice, HeyTell, Amazon's Appstore, Market, Music, etc.

Most are cached/ inactive but none the less in my task manager when freeing up memory when I notice things to be lagging I'd imagine these to be guilty. Android Booster always lists these as killed apps as well when optimizing...

Im familiar somewhat with how android works being that it often fills a large portion of your memory with what it wants to and frees space as it is needed but these apps for me are rarely used...

Im big on battery life being Im in and out of Sales accounts and rely on my phone heavily so I dont want these things running in the background sucking up resources. Not to mention I like a snappy phone...

Also, I know their are app freezers and applications you can program to kill apps at a set interval but again I would like the least amount of garbage running as I can .....

SCH-I510

View 7 Replies View Related

Android :: Generic Task Manager Class For Application / No Dismiss Dialog

Nov 15, 2010

I have a class which extends AsyncTask, which is intended to serve as a generic task manager class for my application. The strange behavior is that the progress dialog shows up, but is never dismissed. I am sure that onPostExecute() gets called for every task instance, as any Log.d("","") statements fire if placed in here, even the Toast messages show up from within this method, but I am not able to dismiss the static dialog. I understand that AsyncTask(s) have access to UI thread at only 2 places [onPreExecute() and onPostExecute()], so I think trying to dismiss the dialog in runOnUiThread() is unnecessary. All calls to executeTask() are made from different onCreate() methods of different activities that need to fetch some data over network before populating some of their UI elements, and I always pass the current activity's context to the tasks. As I do not switch activities until after the related tasks are completed, I believe the activity context objects are still valid (am I wrong to have assumed this???) I have never found any of them to be null while debugging.

Could this be a timing issue? I have also observed that most of the times DDMS shows all tasks get completed before the activity is displayed. If I use new Handler().postDelayed(runnable_which_calls_these_tasks,10); in the onCreate(), and add delaying code in foo_X(), the activities are displayed without any delay, but the dialog will just not dismiss(). I have read through quite a number of articles on this issue but am still not able to figure out exactly where am I going wrong. I do not want to define each task as private inner class Task1 extends AsyncTask<> in all of my activity classes and I would not want to (unless this is the only solution) load my application object with all activity references either as mentioned in this discussion: Is AsyncTask really massively flawed or am I just missing something?. I have spent a week on this and am absolutely clueless :( It would be great if someone can guide me, and let me know what am I missing. Following is the class definition: [I've removed some irrelevant application specific code for clarity]

public class NetworkTask extends AsyncTask<Void, Integer, Boolean> {
private Context UIcontext;
private int operationType;
private static ProgressDialog dialog;
private static int taskCount;
private NetworkTask(int operationType Context context){ this.UIcontext = context;
this.operationType = operationType;
if (taskCount++ == 0) dialog = ProgressDialog.show(context,"","Loading...");
}

public static Boolean executeTask(int operationType, Context context) { return new NetworkTask(operationType, context).execute().get();
} @Override protected void onPreExecute(){ super.onPreExecute();
if (taskCount == 1) dialog.show();
} @Override protected Boolean doInBackground(Void... arg0) { switch(operationType){ case TYPE_1: foo1();
break; case TYPE_2: foo2(); break;
case TYPE_3 foo3(); break; case TYPE_4: foo4(); break;
} @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result);
taskCount--;
if (dialog.isShowing() && taskCount == 0){ dialog.dismiss();
}else { Toast.makeText(UIcontext, "Task#"+ operationType+", m done, but there are "+taskCount+" more", 5).show();
} } }

View 1 Replies View Related

Android :: How To Create Fast Auto Dismiss Message Box?

Aug 24, 2010

I need to create a similar function to Toast.makeText() but more fast to disappear. I have seen such messagebox in the software "Le monde fr" when you select a button from the toolbar down. Its appear and disappear very fast if you move to another icon. I m looking to do the same functionnality but cannot figure out how to do that.Message box should not be modal, what i want is kind of a fast tooltip. The tooltip should appear and disappear fast.

View 4 Replies View Related

Android :: Prevent Dialog Closed / Remain Dialog When Button Is Clicked

Apr 12, 2010

I have a dialog with edittext for input. when i click yes button on dialog, it will validate the input and then close dialog. However, if the input is wrong, i want to remain in the same dialog. every time no matter what input it is, the dialog always automatically close when i click button. How can i disable this. By the way, i use PositiveButton and NegativeButton for the button on dialog

View 2 Replies View Related

Android :: Click To Expand List -and- Click On A Button?

May 31, 2010

I have just started my career as an android programmer, and am currently relying heavily on the sample code and api examples. I have been working with this api example, to produce an expandable list of items (note this example does not use the ExpadableListView).In playing with the example, I tried to add another widget that would become visible and be gone at the same time as the text (mDialogue in the sample code). This works well with another TextView, but as soon as I tried to add a button widget, it stopped working. The list would expand on first click, showing my hidden TextView and Button, but it will not disappear on further clicks. The button is however, clickable, and I was able to set up an onClick listener to change the button text back and forth.I'm starting to wonder, is it just not possible to have a clickable item inside a clickable list item? Or is there some kind of work around? Would it solve my problem if I used ExpandableListView?

View 1 Replies View Related

Android :: On Logout Clear Activity History Stack Preventing Back Button

Jun 9, 2010

All activities in my application require a user to be logged-in to view. Users can log out from almost any activity. This is a requirement of the application. At any point if the user logs-out, I want to send the user to the Login Activity. At this point I want this activity to be at the bottom of the history stack so that pressing the "back" button returns the user to Android's home screen.

I've seen this question asked a few different places, all answered with similar answers (that I outline here), but I want to pose it here to collect feedback. I've tried opening the Login activity by setting its Intent flags to FLAG_ACTIVITY_CLEAR_TOP which seems to do as is outlined in the documentation, but does not achieve my goal of placing the Login activity at the bottom of the history stack, and preventing the user from navigating back to previously-seen logged-in activities. I also tried using android: launchMode ="singleTop" for the Login activity in the manifest, but this does not accomplish my goal either (and seems to have no effect anyway). I believe I need to either clear the history stack, or finish all previously- opened activities. One option is to have each activity's onCreate check logged-in status, and finish() if not logged-in. I do not like this option, as the back button will still be available for use, navigating back as activities close themselves. The next option is to maintain a LinkedList of references to all open activities that is statically accessible from everywhere (perhaps using weak references). On logout I will access this list and iterate over all previously-opened activities, invoking finish() on each one. I'll probably begin implementing this method soon.

I'd rather use some Intent flag trickery to accomplish this, however. I'd be beyond happy to find that I can fulfill my application's requirements without having to use either of the two methods that I've outlined above. Is there a way to accomplish this by using Intent or manifest settings, or is my second option, maintaining a LinkedList of opened activities the best option? Or is there another option that I'm completely overlooking?

View 2 Replies View Related

Android :: Android - Dismiss Dialog Method Not Working

May 21, 2009

I am using the showDialog and dismissDialog methods to show progress dialogs in my app. Moved from creating the dialog and calling show() on it to using this in order to save state when changing orientation. But when I change the orientation from portrait->landscape->portrait, the dismissDialog no longer dismisses the dialog. The dialog stay there all the time and I need to press the back button for it to disappear.

To overcome this issue, I tried adding a removeDialog in onDestroy so that the dialog is not created/displayed twice and before orientation change, the dialog is removed. Tried adding log statements and see what happens:

05-21 12:35:14.064: DEBUG/MyClass(193): callingShowDialog
05-21 12:35:14.064: DEBUG/MyClass(193): onCreareDialog
05-21 12:35:15.385: DEBUG/MyClass(193): onSaveInstanceState
05-21 12:35:15.415: DEBUG/MyClass(193): onDestroy

05-21 12:35:15.585: DEBUG/MyClass(193): callingShowDialog
05-21 12:35:15.585: DEBUG/MyClass(193): onCreareDialog
05-21 12:35:15.715: DEBUG/MyClass(193): onCreareDialog
05-21 12:35:17.214: DEBUG/MyClass(193): onSaveInstanceState
05-21 12:35:17.214: DEBUG/MyClass(193): onDestroy
05-21 12:35:17.275: ERROR/WindowManager(193): android.view.WindowLeaked: Activity com.android.MyClass has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43362088 that was originally added here
05-21 12:35:17.395: DEBUG/MyClass(193): callingShowDialog
05-21 12:35:17.395: DEBUG/MyClass(193): onCreareDialog
05-21 12:35:17.475: DEBUG/MyClass(193): onCreareDialog

If we see here, initially when the activity is displayed, the onCreateDialog is called once and on changing the orientation, onSaveInstanceState and onDestroy are called. But after that, onCreateDialog is called twice (once by a call to showDialog which I make, but why the 2nd time?) and this happens every time I change the orientation hence forth.

View 5 Replies View Related

Android :: Dialog Dismiss / Cancel Handling (Android)

Nov 19, 2009

I never look forward to handling Android dialogs, maybe someone can point me to a better way of doing it than i'm doing right now. Say I have a dialog which has one text field in it, and OK and Cancel buttons. i make the dialog with AlertDialog.Builder, and set click listeners on the buttons and dismiss listener on the dialog. When the dismiss listener fires, can I tell which button caused the dismiss?

I don't see how, so in the click listener, I set a member flag according to which button was clicked. Then in the dismiss listener, I then check the flag to see whether to proceed or not. Arather backward process. Am I missing something? The other issue I have with Android's dialogs is that if the contents fail validation and the dialog needs to be re-presented, I have to re-show it in the dismiss listener. In every other environment known to man, dialogs are (somewhat) modal, so the dialog stays up unless expressly dismissed by code. IMHO, the latter makes more sense.

View 10 Replies View Related

Android :: Dismiss Android Preferences Dialog On Keyboard

Mar 15, 2010

I would like to be able to close the editpreference dialog (as shown here http://twitpic.com/18ttdp) by pressing the 'Done' button on the keyboard. Currently, pressing 'Done' just dismisses the keyboard but leaves the dialog. In other parts of my application I use code similar to the following to intercept the 'Done' key press and execute actions in my activity:

text.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
if (actionId == EditorInfo.IME_ACTION_DONE) {
//do stuff here return true;
} return false;
} } );

However, I am unsure of how to do achieve this same effect in my preference activity or layout XML.

View 2 Replies View Related

Android :: Make DatePickerDialog Not Dismiss After Clicking Set Button?

Apr 25, 2010

Is there any way to make DatePickerDialog not dismiss after clicking set button ?

View 2 Replies View Related

HTC Incredible : Alarm Clock Not Turning Off / Need Dismiss Button

May 3, 2010

I use the alarm clock on the Incredible as my main method of waking me up in the morning. I also have a tendency to hit the snooze button quite a few times before I can get my lazy butt out of bed. I've noticed on 3 occasions now that when the alarm is going off and I try to hit snooze button or "dismiss" button and it's not available. So the alarm is going off and I'm frantically trying to find a button to shut it off. Pressing every button doesn't work so I have to finally shut the phone off. Has anyone else had this issue as well? I've tried to replicate it sitting in front of me a few minutes ago and I can't do it.On one occasion, I noticed that I got a text message when I was trying to find the "dismiss" button. NOt sure if the text message alert had something to do with it.

View 9 Replies View Related

Android : When Click On GDE And Click The Home Button - Switches Back To Stock Home Screen

Dec 19, 2009

When I DL'd the GDE app, I accidentally set my stock droid "HOME" screen as the default screen when the popup box came up asking me to choose between stock Home and GDE. Now when I click on GDE and click the home button, it switches back to the stock Home screen. How to I switch the settings now to set the GDE app as the new home screen?

View 15 Replies View Related

Android :: Add A Dialog - Window In Map When Click Marker?

May 21, 2010

I want to add a dialog or a window in the map when click the marker as folows?but i don't know what to do. Does put the dialog int the Overlay or MapView?

View 12 Replies View Related

Android - Developing Loading Bar After Confirm Dialog Click

Nov 15, 2012

I am developing a utility and facing an issue. The following describes what i intend to achieve: User will click on "Submit"Button. User will be prompted a confirm dialog box. On "No" , it will return. "Yes" click will take it to a method which does some processing. As processing can take sometime, i want to show loading bar after user clicks "Yes" in confirm dialog box. However, When i click "Yes"; the dialog box remains there and i can't see th progress bar.

View 1 Replies View Related

Android :: Show Custom Dialog In After Droid AlertDialog-Click

Jun 3, 2010

I've build an AlertDialog which shows three items. code...

I've searched on stackoverflow/the inet but the solution that was meantioned there was to pass the applicationContext of the Activity to the Dialog (which i did in this case, i saved an reference of the activitys applicationContext in a private variable: myActivity.savedApplicationContext

View 1 Replies View Related

Motorola Droid X :: 2nd Click Of Home Button As Sleep Button?

Nov 2, 2010

I like being able to wake the phone to view the lock screen using the home button at the bottom of the phone, but is there any way to make it so that a second click of that button, or a click of one of the others down there, will make it sleep again? Having to press the power button up top is just an inconvenience.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved