android-dialog

Android: Can i show multiple Dialogs one over another? Is there something like Dialog Z-Level?

a 夏天 提交于 2019-12-05 07:53:50
Is it possible to show multiple Dialogs one over another? Is there something like Dialog Z-Level? I am using DialogFragment where user chooses elements, when he comfirms his choice, it is saved to database and sent on server. if the save action fails I would like to inform user with ... another dialog is it possible? And will it not clear off my first dialog? Thanks in advance. Indeed, it's possible to show multiple dialog Fragments one inside another one. The z-order depends on the order they are created. In the code below there is an example of a FragmentActivity with the behavior that you

How to add TextView and EditText using default AlertDialog programmatically

做~自己de王妃 提交于 2019-12-04 18:55:24
问题 I've been trying to add two elements in a default AlertDialog but I can't seem to make it work. Here's my code: // START Dialog AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); TextView tv = new TextView(this); tv.setText(title); tv.setPadding(40, 40, 40, 40); tv.setGravity(Gravity.CENTER); tv.setTextSize(20); EditText et = new EditText(this); etStr = et.getText().toString(); alertDialogBuilder.setView(et); alertDialogBuilder.setTitle(title); alertDialogBuilder

Make AlertDialog Custom

我怕爱的太早我们不能终老 提交于 2019-12-04 14:20:18
问题 I am using this code to display Alert Dialog holder.tv1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder nointernetconnection = new AlertDialog.Builder( temp); nointernetconnection .setIcon(R.drawable.ic_launcher) .setTitle(list.get(position).getAS_name()) .setMessage(list.get(position).getDesc_art()) .setCancelable(true) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg

Android: How to customize AlertDialog, Dialog an Spinner titles

前提是你 提交于 2019-12-04 14:08:40
问题 I want to customize all dialogs, alertDialogs and spinner. I want to change the color of text and the background of the title bar. I try to explain better: I want the text (JOLLY BAR DI ...) to be white and the background of the title (from the top of the dialog to the soft-blue line below the title included) to be blue (#044592). How can I do it? 回答1: Ok, I've almost solved the problem (I'm answering my own question because it may help others with the same problem as mine). The problem

Dialogs generic function - return boolean based on user button press

一世执手 提交于 2019-12-04 09:47:31
I would like to write a function that would show a alert dialogue box which returns boolean based on the button clicked private Boolean ShowWarningMessageBox(String Title, String message) { boolean returnValue = false; AlertDialog.Builder builder = new AlertDialog.Builder( getApplicationContext()); builder.setTitle(Title); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { returnValue = true; } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int

Android Dim Background of Custom Dialog

青春壹個敷衍的年華 提交于 2019-12-04 05:36:43
As titled, I cannot seem to be able to dim the background of the custom dialog box I have made. Countless solutions online mention the last 3 lines of code in the first snippet below, this has made no impact on the UI of the dialog box. See the following code: Dialog dialog = new Dialog(MainActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog); TextView textView = (TextView) dialog.findViewById(R.id.textView); textView.setText("Custom Text Example"); dialog.show(); WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes(

How to use startActivityForResult() through a DialogFragment?

余生颓废 提交于 2019-12-04 04:30:36
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 startActivityForResult() method; when the user actually enters a username then only username on the main activity gets refreshed and displayed. There is a submit button on the 'addusername' activity which adds the username and does setResult(RESULT_OK); Everything works fine if the username is entered by clicking the 'addusername' button. Now, I have added a dialogue

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

断了今生、忘了曾经 提交于 2019-12-04 02:38:33
The method showDialog(int) from the type Activity is deprecated . What's the reason? and how to solve it? Dheeresh Singh What's the reason? http://developer.android.com/reference/android/app/Activity.html#showDialog(int) Android DialogFragment vs Dialog How to solve it? Use the new DialogFragment class with FragmentManager instead; this is also available on older platforms through the Android compatibility package. http://android-developers.blogspot.in/2012/05/using-dialogfragments.html 来源: https://stackoverflow.com/questions/11220820/the-method-showdialogint-from-the-type-activity-is

Using image from street view

拥有回忆 提交于 2019-12-04 02:03:57
问题 I want to get a picture of streetview (stating latitude and longitude) and display in a dialog, is this possible? I saw some examples here, but not found one that show me how to display the image in dialog. Sorry if already exists this question in the site, but I not found when I search. 回答1: Yes you can, as a URL root you can use this one http://cbk0.google.com/ or maps.google.com and this is a example where you use above mentioned URL by providing location: http://cbk0.google.com/cbk?output

How to set a default value to SharedPreferences programmatically?

蓝咒 提交于 2019-12-04 01:46:43
问题 I am using SharedPreferences to keep the information about user's weight, which I need in my application. The problem is, how to set a default value (eg. 75 kg) automatically after installation? I know how to do it via .xml, but how to do this programmatically? My code: public class SettingsDialogFragment extends DialogFragment{ public static final String PREFS_NAME = "settings"; public Dialog onCreateDialog(Bundle savedInstanceState) { builder.setPositiveButton(R.string.save, new