I'm new at android development so be patient with me.
I have an app which shows a pop up window containing a 'next' button. when it is clicked, previous one closes and new one opens with different information.
the problem is when this button is clicked in very high rate, some times previous dialog window stays and the new window appears at the same time. this does not happen every time. Dialog is used to create the popup window. dialog.dismiss() is used every time the next button is clicked. I'm trying to fix this in case if some user try to do the same thing.
in the button action
dialog.dismiss();
nextaction();
the nextaction() contains the initilization and the image and textloading to the popup window
some thing like
dialog = new Dialog(ctx);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.popupview);
(dialog is global variable)
So can any one be kind enough to give some suggestions. thanks in advance
Related
I know this should not be a big challenge but it really drives me insane.
I am developing a simple soft keyboard input method and basically I have added a button to my softkeyboard, by pressing which, a dialog should pop up to prompt user to do some choices.
By far everything is ok about creating and opening the dialog. Since normally a dialog is created and displayed from outside an activity, so a flick solution could be to create a transparent activity which embedded the dialog in it. By doing so, I could easily start a dialog when user click the button on my softkeyboard.
But one tricky problem is: every time user click the button and the dialog (actually a dialog in a transparent activity) displays, it will always make my softkeyboard hide. I just need to start the dialog without any changes to the status of my softkeyboard -- I want my softkeyboard keeps showing when the dialog starts.
Here is a snapshot of Google Keyboard, it has the similar button which display a dialog and the dialog did not hide the keyboard, this is exactly what I want. So please anyone suggest me how to achieve this. Thanks so much.
THey aren't launching an Activity. They're launching a dialog. Which is tricky from an input method because its a service (you have to specify the dialog's window token to make it show) but doable.
I have two alert dialogs. Whenever app opens, the first dialog is shown. After some time, the second dialog is shown. But here problem is recently created dialog(second one) is in front. But I want the fist created dialog is in front and second one is behind the first one.
The problem with the dialog box is that you can not display two dialog box at a same time. You must hide first dialog box in order to display second one.
You can only display one dialog at the time, but you can "work around" this. When you are about to display your second dialog, you hide your first dialog, but your application remembers that the first dialog was open, so when you hide your second dialog you displays the first dialog again. In reality this will go so fast so the user is fooled that the dialog is layered over eachother(if they have the same dimensions).
But you cannot display a dialog on top of another dialog.
You can display first dialog in front :
When you are calling to display second one at that time call first dialog again so, that is in from view of your screen.
Let me know you understand this or not.. otherwise i will provide code for it..
You cant make two dialog active at same time either one should active and the other should inactive.In your case if you want the second should come background of fist then you have to call first dialog from the second.
I have an Activity, and inside that activity, i have several dialogs popup at unknown times. I would like the user to still be able to interact with the current activity (Press Buttons etc) whilst the dialog is being displayed. Is this possible or would there be an alternative solution to this? I have setup my dialog like so, to prevent it from closing on outside touch:
achievDialog = new Dialog(this);
achievDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
achievDialog.setContentView(R.layout.achiev_get);
achievDialog.setCanceledOnTouchOutside(false);
I have an app where the user presses a button and a custom spinner is popped so that the user can choose between nine colors. I want the spinner to be dismissed, when the user touches the background (every place on the sreen except from the spinner). Is this possible?
I tried to add an onTouchListener on the image that covers the background and call
dialog.dismiss();
but it does not work.
My spinner is custom Spinner, set in an xml file and popped with:
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.colorchooser);
Thank you in advance
First of all you should be able to add
dialog.setCanceledOnTouchOutside(true);
to accomplish what you want.
But the dismiss() method should also be working, I would guess that the place your are calling dialog.dismiss() is not reachable at the current moment.
When my app is first run, I would like to have a welcome message displayed in a dialog box. Then the user can click next at the bottom, and the box stays but a new layout is displayed where the user can input information.
How would I go about this? It would also be great if I was able to add an animation between the two layouts, the second one sliding in from the right for example. Is this possible?
I was thinking I may be able to use
builder.setView(secondlayout);