alertD.setView(promptView);
final EditText input = new EditText(this); AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Title"); alertDialog.setMessage("Message"); alertDialog.setView(input, 10, 0, 10, 0); // 10 spacing, left and right alertDialog.setButton("OK", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Clicked } }); alertDialog.show();
final EditText input = new EditText( getContext() ); float dpi = ctx.getResources().getDisplayMetrics().density; AlertDialog dialog = (new AlertDialog.Builder(getContext())) .setTitle("Rename track") .setMessage("Track name:") .setPositiveButton("OK", null) .setNegativeButton("Cancel", null) .create(); dialog.setView(input, (int)(19*dpi), (int)(5*dpi), (int)(14*dpi), (int)(5*dpi) ); dialog.show();
public DialogUtils show(){ if(alertDialog==null){ alertDialog=new AlertDialog.Builder(mContext).create(); alertDialog.setView(mContentView); } alertDialog.show(); return this; }
AlertDialog alert = cndtnsbuilder.create(); alert.setView(LayoutInflater.from( currentactivity.this).inflate( R.layout.dialog, null)); alert.show();
LayoutInflater mLayoutInflator = LayoutInflater.from(this); final View customDialogView = mLayoutInflator.inflate( R.layout.journey_details, null); final AlertDialog customDialog= new AlertDialog.Builder(this).create(); customDialog.setView(customDialogView); customDialog.show();
final AlertDialog alertDialog = new AlertDialog.Builder(this).create(); View dialog_layout = getLayoutInflater().inflate(R.layout.dialog_layout, null); // Create the text field in the alert dialog... EditText text1 = (EditText) dialog_layout.findViewById(R.id.text1); EditText text2 = (EditText) dialog_layout.findViewById(R.id.text2); alertDialog.setView(dialog_layout); alertDialog.show();
private void initColorPickerView() { LayoutInflater layoutInflater = this.getLayoutInflater(); @SuppressLint("InflateParams") View view = layoutInflater.inflate(R.layout.layout_dialog_colorpicker, null); this.colorPickerView = view.findViewById(R.id.ColorPickerView); super.setView(view); }
AlertDialog dialog = new AlertDialog.Builder(MainActivity.this).create(); LayoutInflater inflater = LayoutInflater.from(MainActivity.this); dialog.setTitle("Title"); View view = inflater.inflate(R.layout.<xml_image>, null); // xml Layout file for imageView ImageView img = (ImageView) view.findViewById(R.id.image); img.setImageResource(R.drawable.dust); dialog.setView(view); dialog.show();
AlertDialog MyDialog; AlertDialog.Builder builder = new AlertDialog.Builder(this); //maybe set positive / negative buttons here AlertDialog d = builder.create(); d.setView(view); d.show();
AlertDialog dialog = new AlertDialog(getActivity()){ @Override public boolean dispatchTouchEvent(MotionEvent ev) { dismiss(); return false; } }; dialog.setView(yourView); dialog.show();
View someView = ...; View someOtherView= ...; AlertDialog.Builder builder = new AlertDialog.Builder(this); //sets the view, but doesn't show anything. builder.setView(someView); //now we have an instance of AlertDialog, still not shown AlertDialog dialog = builder.create(); //now we showed it dialog.show(); //...(wait some time) //now we changed its view after being shown dialog.setView(someOtherView);
final AlertDialog alertDialog = new AlertDialog.Builder(this).create(); final EditText input = new EditText(this); input.setHint("hint"); alertDialog.setTitle("title"); alertDialog.setMessage(message); alertDialog.setView(input);
AlertDialog alertDialog = new AlertDialog.Builder( getActivity()).create(); alertDialog.setTitle("easyQ"); alertDialog.setMessage("reason"); LayoutInflater inflater = (getActivity()).getLayoutInflater(); final View dialogView=inflater.inflate(R.layout.fragment_response,null); alertDialog.setView(dialogView); alertDialog.show(); alertDialog.show();
AlertDialog.Builder builder = new AlertDialog.Builder(contextActivity,android.R.style.Theme_Holo_Dialog_NoActionBar); AlertDialog alertDialog = builder.create(); alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); alertDialog.setView(myLayout,0,0,0,0); alertDialog.show();
LayoutInflater factory = LayoutInflater.from(ChatActivity.this); final View deleteDialogView = factory.inflate( R.layout.current_location_map_dialog, null); final AlertDialog alertDialog = new AlertDialog.Builder(ChatActivity.this).create(); alertDialog.setView(deleteDialogView); alertDialog.setCancelable(true); alertDialog.show(); alertDialog.setCanceledOnTouchOutside(true); Hope this will work for you .I use xml of desired size in android for alert dialog
AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setTitle("easyQ"); alertDialog.setMessage("reason"); alertDialog.setView(listView); alertDialog.show();
final EditText input = new EditText(this); AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Title"); alertDialog.setMessage("Message"); alertDialog.setView(input, 10, 0, 10, 0); // 10 spacing, left and right alertDialog.setButton("OK", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Clicked } }); alertDialog.show();
public void onClick(View view) { mEST.setItemColor(view.getDrawingCacheBackgroundColor()); if (mAlertDialog != null) { mAlertDialog.setView(null); mAlertDialog.dismiss(); mAlertDialog = null; } else { Log.e(TAG, "--- buildAndShowColorDialogue: can't find alertDialog"); } } });
public void onClick(View view) { mEST.setBackgroundColor(view.getDrawingCacheBackgroundColor()); if (mAlertDialog != null) { mAlertDialog.setView(null); mAlertDialog.dismiss(); mAlertDialog = null; } else { Log.e(TAG, "--- buildAndShowColorDialogue: can't find alertDialog"); } } });