android-dialog

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

孤街醉人 提交于 2019-11-29 05:39:40
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 WindowToken{4067a268 token=null}. Aborting. D/AndroidRuntime( 1923): Shutting down VM W/dalvikvm( 1923)

Android Alert Dialog Background Issue API 11+

半世苍凉 提交于 2019-11-29 02:45:23
问题 I create a AlertDialog with the code below. For some reason I'm getting an extra background (see pic) on Honeycomb and above. The code crashes fine for anything below honeycomb. MyCustomDialog is simply Theme.Dialog for < API-11 and Theme.Holo.Dialog for API-11 and up. Any idea why I'm getting the extra background? Any idea why it crashes for API < 11? It works fine if I remove the Theme. Update figured out the answer to Question #2. Seems the constructor AlertDialog.Builder(Context context,

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

徘徊边缘 提交于 2019-11-29 01:34:35
问题 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

Android 6.0 Dialog text doesn't appear

£可爱£侵袭症+ 提交于 2019-11-29 01:05:22
I updated my phone to Android 6.0 and I have these 2 problems with dialogs: 1)The title is shown but the messages isn't for alert dialog(SOLVED): new AlertDialog.Builder(context).setTitle("Title").setMessage("Message"); 2)Also custom dialog fragment's title is not shown(NOT SOLVED): getDialog().setTitle("Title"); There was not such a problem in lollipop or in older versions, the problem appeared only after updating my phone to marshmallow. How to solve the problem? Use constructor with theme for Lollipop and newer android versions: Dark theme AlertDialog.Builder builder; if (Build.VERSION.SDK

queryIntentActivityOptions not working

落爺英雄遲暮 提交于 2019-11-28 11:11:55
问题 I am trying to create a dialog that shows all applications in a user phone that can be used to select a picture from the storage or take one using the camera. This is a follow-up to my previous question. The best way I have found to populate my listview in my customized dialog with applications that can perform the above actions is to use queryIntentActivityOptions() method but it's not working. my listview isn't been populated with apps that can be used to access an image or take one using

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

笑着哭i 提交于 2019-11-28 07:47:34
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 savedInstanceState) { setTheme(android.R.style.Theme_DeviceDefault_Dialog); super.onCreate(savedInstanceState);

Adding positive / negative Button to DialogFragment's Dialog

断了今生、忘了曾经 提交于 2019-11-28 07:10:55
I've already written a DialogFragment. Now I've realized that I want it to have a positive and a negative button just like an AlertDialog. How can I achieve such a thing while maintaining the code that I've written? public class DoublePlayerChooser extends DialogFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(DialogFragment.STYLE_NORMAL,0); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getActivity()) .setTitle("title") .setPositiveButton("OK", new DialogInterface

How to update data in a Custom Dialog

拥有回忆 提交于 2019-11-28 06:51:32
问题 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

Android make a dialog appear in fullscreen

我只是一个虾纸丫 提交于 2019-11-28 06:23:05
I need the dialog to fill the screen except for some space at the top and the bottom. I've search for a solution but couldn't find one probably because I'm declaring it in an onClickListener . Can someone please give a solution? Activity code: sort.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub AlertDialog.Builder sort = new AlertDialog.Builder(HomeScreen.this); // Get the layout inflater LayoutInflater inflater = HomeScreen.this.getLayoutInflater(); View sortView = inflater.inflate(R.layout.sort_layout, null); sort

Android get full width for custom Dialog

时光总嘲笑我的痴心妄想 提交于 2019-11-28 06:11:50
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="http://schemas.android.com/apk/res/android" android:id="@+id/layoutRoot" android:layout_width="fill