Dialog dialog = new Dialog(this, R.style.PauseDialog); // Setting the title and layout for the dialog dialog.setTitle(R.string.pause_menu_label); dialog.setContentView(R.layout.pause_menu);
Dialog dlg = new Dialog(context); LayoutInflater li = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = li.inflate(R.layout.my_layout, null, false); dlg.setContentView(v); dlg.show();
public void openDialog() { final Dialog dialog = new Dialog(context); // Context, this, etc. dialog.setContentView(R.layout.dialog_demo); dialog.setTitle(R.string.dialog_title); dialog.show(); }
Dialog dialog = new Dialog(Activity.this); dialog.setContentView(R.layout.list) ListView lv = (ListView ) dialog.findViewById(R.id.lv); dialog.setCancelable(true); dialog.setTitle("ListView"); dialog.show();
Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.custom_dialog); Button okay = (Button) dialog.findViewById(R.id.button1); okay.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // do your work } });
private void showDialog(){ final Dialog dialog = new Dialog(this); View view = getLayoutInflater().inflate(R.layout.dialog_main, null); ListView lv = (ListView) view.findViewById(R.id.custom_list); // Change MyActivity.this and myListOfItems to your own values CustomListAdapterDialog clad = new CustomListAdapterDialog(MyActivity.this, myListOfItems); lv.setAdapter(clad); lv.setOnItemClickListener(........); dialog.setContentView(view); dialog.show(); }
Context mContext = getApplicationContext(); Dialog dialog = new Dialog(mContext); dialog.setContentView(R.layout.custom_dialog); dialog.setTitle("Custom Dialog"); TextView text = (TextView) dialog.findViewById(R.id.text); text.setText("Hello, this is a custom dialog!"); ImageView image = (ImageView) dialog.findViewById(R.id.image); image.setImageResource(R.drawable.android);
Dialog dialog = new Dialog(this,R.style.ThemeDialogCustom); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //you can move the dialog, so that is not centered // dialog.getWindow().getAttributes().y = 50; //50 should be based on density dialog.setContentView(yourLinearLayout); dialog.setCancelable(true); //dialog.setOnCancelListener(cancelListener); dialog.show();
final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.custom_dialog); dialog.setTitle("Custom Alert Dialog"); final EditText editText = (EditText) dialog.findViewById(R.id.editText); Button btnSave = (Button) dialog.findViewById(R.id.save); Button btnCancel = (Button) dialog.findViewById(R.id.cancel); dialog.show();
private void showPictureialog() { final Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar); // Setting dialogview Window window = dialog.getWindow(); window.setGravity(Gravity.CENTER); window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); dialog.setTitle(null); dialog.setContentView(R.layout.selectpic_dialog); dialog.setCancelable(true); dialog.show(); }
Dialog dialog = new Dialog(mContext); dialog.setContentView(R.layout.custom_dialog); dialog.setTitle("Custom Dialog");
Dialog dialog = new Dialog(this); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // layout to display dialog.setContentView(R.layout.about_program_dialog_layout); // set color transpartent dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.show();
Dialog customDialog; LayoutInflater inflater = (LayoutInflater) getLayoutInflater(); View customView = inflater.inflate(R.layout.dialog, null); // Build the dialog customDialog = new Dialog(this, R.style.CustomDialog); customDialog.setContentView(customView); customDialog.show();
final Dialog dialog = new Dialog(context); dialog.getWindow(); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.yourlayout); dialog.show();
Dialog alert = new Dialog(this); alert.requestWindowFeature(Window.FEATURE_NO_TITLE); alert.setContentView(R.layout.title); TextView msg = (TextView)alert.findViewById(R.id.textView1); msg.setText("Hello Friends.\nIP address : 111.111.1.111"); alert.show();
Dialog pauseDialog = new Dialog(this, R.style.PauseDialog); pauseDialog.setTitle(R.string.pause_menu_label); pauseDialog.setContentView(R.layout.pause_menu);
protected class Asyctast extends AsyncTask<String, Integer, Integer> { @Override protected Integer doInBackground(String... params) { // TODO Auto-generated method stub Log.d("Asynctask", ""+params); Looper.prepare(); ImageThumbnailsActivity m = new ImageThumbnailsActivity(); Toast.makeText(ImageThumbnailsActivity.this,""+params ,Toast.LENGTH_SHORT).show(); final Dialog dialog_options = new Dialog(ImageThumbnailsActivity.this); dialog_options.setContentView(R.layout.option); dialog_options.show(); Looper.loop(); return null; } }
Dialog alertDialog = new Dialog(this); alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); alertDialog.setContentView(R.layout.tabs); alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); alertDialog.show();
Dialog dialog=new Dialog(this,R.style.cust_dialog); dialog.setContentView(R.layout.fragment_features_dialog); dialog.setTitle(R.string.features);
Dialog dialog = new Dialog(getActivity()); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // layout to display dialog.setContentView(R.layout.add_edit); // set color transpartent dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.show();