android-dialog

Custom Menu on button click as drop down

自古美人都是妖i 提交于 2019-11-28 05:55:01
问题 I am trying to implement the action bar functionality of the flipkart app. . For this I have successfully created a custom Action Bar but I am facing problems in showing the menu as drop down on overflow icon click. If I try Android Option Menu on button click then on I am getting the menu without icons (4.2.2) at the bottom center of my screen. Using a custom dialog or alert dialog fades the background and they also appear on the center of the screen. What should I do to get the

How to show Dialog Box from the class which extends Application in android?

大憨熊 提交于 2019-11-27 23:14:14
问题 I want show a dialog box after specific condition , but for demo right now I want show a Dialog Box from the class which extends Application . here is my code public class ControlApplication extends Application { @Override { super.onCreate(); final Dialog dialog = new Dialog ( getApplicationContext() ); dialog.setTitle("zakasssssssssssssssssss"); dialog.setCancelable(false); dialog.show(); } } but at the dialog.show() I am getting error like Attempted to add window with non-application token

AlertDialog: How To Remove Black Borders Above and Below View

三世轮回 提交于 2019-11-27 19:40:39
This question has been asked before: AlertDialog custom title has black border But was not answered satisfactorily - and is missing some information. I'm trying to create a custom dialog in Android without a title and without any buttons along the bottom. However, the resulting dialog has black "borders"/"spacing"/something along the top and bottom of the view. From the Documentation : A dialog made with the base Dialog class must have a title. If you don't call setTitle(), then the space used for the title remains empty, but still visible. If you don't want a title at all, then you should

Can't make the custom DialogFragment transparent over the Fragment

限于喜欢 提交于 2019-11-27 17:16:34
I need to create a dialog over a fragment (that takes up the whole screen). The dialog needs to be a floating dialog that will be positioned over the fragment with the fragment darkened out outside of the fragment.. For the custom Dialog, i have a linearLayout that has curved edges, no matter what i do, the dialog has a black bordering on all sides (very small). I've tried everything to make it transparent and go away (so that all of the dialog is just the linear layout - curved box) For the DialogFragment, this is what I have for onCreateView @Override public View onCreateView(LayoutInflater

AlertDialog with positive button and validating custom EditText

青春壹個敷衍的年華 提交于 2019-11-27 12:51:01
I have created simple AlertDialog with positive and negative buttons. Positive button has registered DialogInterface.OnClickListener , where I get EditText value. I have to validate it (for example if it has to be not null) and if value is not correct, disallow to close this dialog. How to prevent dismissing dialog after click and validate ? Dialog creation: AlertDialog.Builder builder = new AlertDialog.Builder(YourActivity.this); builder.setCancelable(false) .setMessage("Please Enter data") .setView(edtLayout) //<-- layout containing EditText .setPositiveButton("Enter", new DialogInterface

Show dialog from fragment?

有些话、适合烂在心里 提交于 2019-11-27 06:15:03
I have some fragments that need to show a regular dialog. On these dialogs the user can choose a yes/no answer, and then the fragment should behave accordingly. Now, the Fragment class doesn't have an onCreateDialog() method to override, so I guess I have to implement the dialogs outside, in the containing Activity . It's ok, but then the Activity needs to report back the chosen answer somehow to the fragment. I could of course use a callback pattern here, so the fragment registers itself at the Activity with a listener class, and the Activity would report back the answer thru that, or

Android get full width for custom Dialog

这一生的挚爱 提交于 2019-11-27 05:34:53
问题 in my application my created custom dialog dont have full height and i can not change and customize that.for example see this screen shot: My code: final Dialog contacts_dialog = new Dialog(ActivityGroup.this, R.style.theme_sms_receive_dialog); contacts_dialog.setContentView(R.layout.dialog_schedule_date_time); contacts_dialog.setCancelable(true); contacts_dialog.setCanceledOnTouchOutside(true); contacts_dialog.show(); layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android

Can't make the custom DialogFragment transparent over the Fragment

亡梦爱人 提交于 2019-11-27 04:11:06
问题 I need to create a dialog over a fragment (that takes up the whole screen). The dialog needs to be a floating dialog that will be positioned over the fragment with the fragment darkened out outside of the fragment.. For the custom Dialog, i have a linearLayout that has curved edges, no matter what i do, the dialog has a black bordering on all sides (very small). I've tried everything to make it transparent and go away (so that all of the dialog is just the linear layout - curved box) For the

Android 'Unable to add window — token null is not for an application' exception

人走茶凉 提交于 2019-11-27 03:24:36
I get the following Android exception when I try to open a dialog. Can someone please help me understand what is going on and how can I fix this problem? android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application at android.view.ViewRoot.setView(ViewRoot.java:509) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) at android.app.Dialog.show(Dialog.java:241) Peter Knego I'm guessing - are you trying to create Dialog with an application context? Something like

how to programatically theme an activity to be like a dialog?

我们两清 提交于 2019-11-27 01:41:18
问题 Question How does one programatically (without touching the AndroidManifext.xml ) set the theme of an Activity so that it looks like a dialog? Note: I am ok with modifying the AndroidManifext.xml as long as it does not need to be modified in order to switch between making it look like a normal activity or a dialog. What I've tried so far I tried the following as per this stackoverflow answer: public class DialogActivity extends Activity { @Override protected void onCreate(Bundle