android-dialog

Show dialog activity over another app from background

家住魔仙堡 提交于 2019-11-30 09:14:32
问题 Say you have an app A which opens up another app B (e.g. a map), which is not controlled by you (i.e. it's a preexisting app). So now app A is in the background. Suppose an event occurs and A wants to show a floating dialog over app B's UI (while leaving app B's activity visible behind it). Is this possible? (The usual answer to this would be to display a notification, but this is not a mass market app, and we are trying to get the user's attention very directly.) Currently, I was trying to

How to remove transparent dark background outside of dialog box

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 08:44:37
I want to remove a transparent dark backgrond outside of dialog box. I tried with: final Dialog dialog = new Dialog(this); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE)); this.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE)); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.spinner_layout); getWindow().getDecorView().setBackgroundResource(android.R.color.transparent); chuky Your question has already been answered here Code from the link: Add this to your styles.xml: <?xml version="1

Custom Dialog size to match Theme.Holo.Light.Dialog

馋奶兔 提交于 2019-11-30 04:09:53
If I have an Activity that has it's theme set to Theme.Holo.Light.Dialog , it will scale great. It will fill the screen on phones in portrait mode almost entirely but in landscape mode it won't stretch unreasonably long. For example, in this picture from Google, you can see the dialog not filling the whole screen. It won't either collapse to match the width of the title like what will happen if you have your own Dialog build by having a class that extends the Dialog class. This is what will happen with my layout. What properties do I need to apply to the LinearLayout to make it scale pretty?

How can I add a third button to an Android Alert Dialog?

ⅰ亾dé卋堺 提交于 2019-11-29 20:24:41
The API says that the Alert Dialog can have one, two or three buttons, but the SDK only allows for a positive and negative button. How then can I add a third button? sahhhm This code snippet should help explain the three different buttons you can use: alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Dialog Button"); alertDialog.setMessage("This is a three-button dialog!"); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "Button 1 Text", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //... } }); alertDialog.setButton

DialogFragment displayed from onContextItemSelected doesn't survive onPause/onResume

一世执手 提交于 2019-11-29 19:05:11
问题 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 invoke it via #2 and I pause the activity (by going Home) and the resuming it via the task switcher, the dialog is no longer displayed. The fragment is there, and I can rotate the device and show the dialog. I experimented, and if I put the

Softkeyboard not showing in AlertDialog for phone only

China☆狼群 提交于 2019-11-29 16:11:18
Why the softkeyboard is showing only on the tablet is a mystery ! Here is the code that I have used. AlertDialog.Builder builder = new AlertDialog.Builder(CurrentActivityName.this); builder.setTitle(“Title”); builder.setMessage(“Message”); final EditText input = new EditText(CurrentActivityName.this); builder.setView(input); builder.setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //my code } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void

How to get dialog size?

眉间皱痕 提交于 2019-11-29 13:17:48
I am looking for a way to get size of a custom dialog. I went through this question, but the only answer given is pretty useless, because if I try mDialog.getWindow().getAttributes().height; it only returns -2, which is a constant for WRAP_CONTENT attribute which I set to dialog. How can I get the size of it. I want to know the siye for the background image. Actually, in Android it doesn't work like in iOS - you can't get the size of the View itself, what you can do, though, is to ask for the size of the ROOT layout of that view. e.g.: myDialog.this.findViewById(R.id.dialog_root_layout)

How to update data in a Custom Dialog

試著忘記壹切 提交于 2019-11-29 12:55:55
The user at the moment clicks on a row which contains data and a Dialog with text fields is displayed. I want the user to update the strings by using this Dialog. How can I do this? I have an update method already in my Database Class, but I'm not sure how to implement the update in the Dialog Database Class package ie.example.artur.projectrepeat; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteQueryBuilder; /

Custom Menu on button click as drop down

拈花ヽ惹草 提交于 2019-11-29 12:20:25
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 functionality similar as shown in the image above? Haresh Chhelana Try this way,hope this will help you to solve

How to remove transparent dark background outside of dialog box

青春壹個敷衍的年華 提交于 2019-11-29 11:54:20
问题 I want to remove a transparent dark backgrond outside of dialog box. I tried with: final Dialog dialog = new Dialog(this); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE)); this.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE)); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.spinner_layout); getWindow().getDecorView().setBackgroundResource(android.R.color.transparent); 回答1: Your