Questions tagged [android-dialog]

Base class for Dialogs. A dialog in Android is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed.

A dialog is usually a small window that appears in front of the current Activity. The underlying Activity loses focus and the dialog accepts all user interaction. Dialogs are normally used for notifications that should interrupt the user and to perform short tasks that directly relate to the application in progress (such as a progress bar or a login prompt).

Official Android Dialog Documentation

1460 questions
9
votes
4 answers

Android Dialog is showing again after Activity is re-created

I have an Activity and need to show Dialog in it. Everything works fine here. I've overrided onCreateDialog method in Activity, here is the code: @Override protected Dialog onCreateDialog(int dialog) { if(dialog == 10) { …
Eramir
  • 482
  • 1
  • 5
  • 18
9
votes
1 answer

WebView in Dialog

I have an application where I need to load a small webpage inside of webview. The webview needs to load up inside a dialog. I've tried to implement it; but everytime an empty dialog loads up and seems to have no content inside it. The code i've used…
Avinash
  • 174
  • 1
  • 1
  • 8
9
votes
2 answers

NullPointerException when creating a new Dialog

I have a DialogFragment that creates a listview dialog and on a list item click I want to display an alert dialog but when I create the dialog it gives me a NullPointerException with an error that I have never seen before 08-05 11:40:42.315:…
tyczj
  • 71,600
  • 54
  • 194
  • 296
9
votes
1 answer

Dialog themed activity : positive and negative buttons

I'm trying to theme an activity as an AlertDialog. The problem I'm facing is that I can't find a way to put two buttons on the bottom of my window that would look like the positive and negative buttons of an AlertDialog I've already added that line…
MagicMicky
  • 3,819
  • 2
  • 37
  • 53
9
votes
1 answer

The method showDialog(int) from the type Activity is deprecated in android?

The method showDialog(int) from the type Activity is deprecated. What's the reason? and how to solve it?
Sekar
  • 1,061
  • 7
  • 21
  • 38
9
votes
1 answer

How do I hide the cancel button in a custom DialogPreference in Android?

How do I hide the cancel button in a custom DialogPreference in Android?
Thomas Dignan
  • 7,052
  • 3
  • 40
  • 48
8
votes
4 answers

Android Java: How do I prevent my Dialog box from showing MainActivity appname briefly when the Dialog closes?

I'm fairly new to Android development and I've created my first "real" application that does the following: Launches MainActivity MainActivity processes Extra Data and then displays a ViewDialog that extends Dialog. ViewDialog has a showDialog()…
Chimera
  • 5,884
  • 7
  • 49
  • 81
8
votes
3 answers

espresso: Assert a Dialog is not shown

How can I assert a dialog is not shown? At the moment I have a test which checks if text does not exist in a dialog where a dialog doesn't show onView(withText("Mobile connection")).inRoot(isDialog()).check(doesNotExist()); But I get a…
Tim Kist
  • 1,164
  • 1
  • 14
  • 38
8
votes
3 answers

Prevent Dialog (or DialogFragment) from closing when app goes to background

It's pretty common for my app to show a progress or AlertDialog to the user. If the user puts the app into the background and then returns later, I want the Dialog to still be shown. Is there a way to make Android handle this? I'd like it to either…
Mark Herscher
  • 1,761
  • 2
  • 19
  • 32
8
votes
3 answers

Scroll dialog after keyboard is on

I have some dialog with EditText fields. when i want to fill some EditText the keyboard is opened and I can't fill some fields above. i should close the keyboards and after click on EditText above. How can I make my dialog scrollable when the…
HK.avdalyan
  • 724
  • 1
  • 6
  • 21
8
votes
1 answer

VideoView is not properly rendered after Dialog's keyboard disappeared

I simplified my problem to the smallest example when it can be reproduced. So: 1 activity with VideoView and ImageView. After clicking on ImageView AlertDialog is showed. AlertDialog have 1 EditText field. I touch this EditText and standard…
kolobok
  • 3,835
  • 3
  • 38
  • 54
8
votes
3 answers

Force user to select option in dialog

On starting the application for the first time I wanted to prompt the user (by dialog) to select their city, which would then consequently save their preference and load the proper data into the listview. However, I've noticed that a dialog can be…
8
votes
2 answers

How to use startActivityForResult() through a DialogFragment?

My app requires a username to be added to function properly. The mainActivity displays the username on the top which it retrieves form the database. The mainActivity also has a button which leads to 'addusername' activity through…
krtkush
  • 1,378
  • 4
  • 23
  • 46
8
votes
2 answers

DialogFragment displayed from onContextItemSelected doesn't survive onPause/onResume

I have a DialogDragment which I can show one of two ways: 1) By tapping on a ListView item from its OnItemClickListener 2) By activating a the ListView's context menu and selecting a menu item Doing #1 works fine under all lifecycle events, but if I…
Tom anMoney
  • 1,231
  • 1
  • 14
  • 29
8
votes
2 answers

View not attached to window manager (whats the solution?)

I got hundreads of error reports from my app and all of them is the same. It is really annoying because in my test devices (HTC Wildfire, Galaxy S I-II-III, Galaxy Mini, Galaxy Tab 10) this error NEVER occured, neither to me or my test buddy, looks…
Adam Varhegyi
  • 11,307
  • 33
  • 124
  • 222