android-dialog

Dialog with custom view background

旧城冷巷雨未停 提交于 2020-01-20 08:34:54
问题 Solved: see answer below I am sub-classing Dialog to create a dialog with a custom background. I have added a subclass View to the Dialog and it is drawing the bitmap background and layout correctly. But the buttons will not respond to any touch events. I suspect the LinearLayout has to be loaded in the Dialog class, but I think I have to load it in the view class to draw on top of the bitmap. I am totally new to Android dev, so I apologize for the question. Here is what I am doing: public

Android custom dialog gives an error

筅森魡賤 提交于 2020-01-16 14:22:06
问题 In my android app I have to popup a dialog on a button click event . But when I click on the button the app stops working. I load the pre designed layout into the dialog. I will post a code segment. Button login = (Button) findViewById(R.id.btn_login); login.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(getApplication()); dialog.setContentView(R.layout.journey_details); dialog.setTitle("Android Custom Dialog Box"); Button

Android custom dialog gives an error

試著忘記壹切 提交于 2020-01-16 14:21:35
问题 In my android app I have to popup a dialog on a button click event . But when I click on the button the app stops working. I load the pre designed layout into the dialog. I will post a code segment. Button login = (Button) findViewById(R.id.btn_login); login.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(getApplication()); dialog.setContentView(R.layout.journey_details); dialog.setTitle("Android Custom Dialog Box"); Button

Insert data to a database using dialogbox

二次信任 提交于 2020-01-16 14:19:53
问题 I am trying to add some data to da database. This is working fine, using an intent (commented in below text) to an activity(shown later). Now, I am trying to do the same using a dialog , but I am confused about how to do that. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.places_layout); ........ fab1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /* THIS IS WORKING WITH

Cancel/dismiss alertdialog builder from any other method in same class in android?

五迷三道 提交于 2020-01-15 10:27:08
问题 I have a java class not activity. From any other activity, I called this class and in that class I created alertdialog builder. In that I inflate data from db. Now In this class, I have other listener and method also. In one of the method, I want to dismiss/cancel this dialog. Like how we do setResult(RESULT_OK, intent); finish(); in any activity, same thing I want to do in class. Code: This method I called from activity. public void showProvidersDialog(long customCategoryId) { categoryId =

Place a button inside DialogFragment's title

佐手、 提交于 2020-01-15 09:45:52
问题 I show a DialogFragment from another DialogFragment . I need to set title and a button just next to it. I don't want to reimplement the theme and create a custom view inside DialogFragment 's content view instead of dialog title (because it's error-prone and time wasting). Is it even possible? I tried many API functions, AlertBuilder , ActionBar , this and that, still didn't found anything that fits my needs. 回答1: Try something like this: // Title final int titleId = getResources()

What is the difference between PopUpWindow and Dialog?

倖福魔咒の 提交于 2020-01-12 07:31:10
问题 Basically the question is stated in the title. Any preferences in using one or another? Maybe some specific tasks where one is superior/ more efficient/ better than the other? 回答1: Dialog "A dialog 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." AlertDialog has many variants and as far as I can assume your problem,

Android: How to override onBackPressed() in AlertDialog?

断了今生、忘了曾经 提交于 2020-01-12 02:56:46
问题 I have an AlertDialog dlgDetails which is shown from another AlertDialog dlgMenu . I would like to be able to show dlgMenu again if the user presses the back button in dlgDetails and simply exit the dialog if he presses outside the dialog. I think the best way to do this is to override onBackPressed for dlgDetails, but I am not sure how to do that since AlertDialogs must be created indirectly using the Builder. I am trying to create a derived AlertDialog ( public class AlertDialogDetails

Android M - custom permission dialog style

落爺英雄遲暮 提交于 2020-01-11 10:21:37
问题 While implementing the new Android M permission model I noticed that the permissions dialog does not respect the theming of my styles.xml. In my styles.xml I override the dialog and alertdialog style like this: <item name="android:dialogTheme">@style/Theme.dialog</item> <item name="android:alertDialogTheme">@style/Theme.dialog</item> Is it possible to change the theming? Or is it because this is a system dialog like in the device settings? 回答1: No, it's not possible. The permissions dialog is

Change background, textcolor of AlertDialog

跟風遠走 提交于 2020-01-06 12:26:11
问题 I try to change background and textcolor of AlertDialog. But I can change only color of title with android:windowTitleStyle Activity: AlertDialog.Builder adb = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDialogCustom)); styles.xml style name="AlertDialogCustom" parent="Holo.Theme.Sherlock" How can I do that? Thanks. 回答1: adb.setMessage(Html.fromHtml("<font color='#FF0000'><b>John:</b></font>"+"How are you?")) this is for changing text color You can create you own dialog