public void showAlert(String title,String message){ AlertDialog ad = new AlertDialog.Builder(this); ad.create().setCancelable(true).setTitle(title).setMessage(message); ad.setButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); }
AlertDialog dialog = new AlertDialog.Builder(MainActivity.this).setView(view).create(); dialog.create(); WindowManager.LayoutParams lp = dialog.getWindow().getAttributes(); Log.d("TAG", "First lp width and height" + lp.width + " " + lp.height);
AlertDialog.Builder dialog = new AlertDialog.Builder(AddData.this); DialogInterface dia = new DialogInterface(); //Create a custom layout for the dialog box LayoutInflater inflater = (LayoutInflater)AddData.this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.add_rep_1_set, parent, false); TextView title = (TextView)layout.findViewById(R.id.rep_1_title); Button add_item = (Button)layout.findViewById(R.id.add_button); final AlertDialog Dial = alertDialog.create(); title.setText(workout_items[position]); Dial.setView(layout); AlertDialog alertDialog = dialog.create(); add_item.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Dial.dismiss(); } }); Dial.show();
@Override public void onClick(View v) { AlertDialog getSurveyAlert = new AlertDialog.Builder(QuestionListActivity .this).create(); getSurveyAlert.setTitle("Enter QR Code"); getSurveyAlert.setMessage("Choose a source"); getSurveyAlert.setButton("Camera", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); getSurveyAlert.setButton2("text", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); getSurveyAlert.create().show(); } });
bntGetSurveys.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AlertDialog getSurveyAlert = new AlertDialog.Builder(QuestionListActivity .this).create(); getSurveyAlert.setTitle("Enter QR Code"); getSurveyAlert.setMessage("Choose a source"); getSurveyAlert.setButton("Camera", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); getSurveyAlert.setButton2("text", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); getSurveyAlert.create().show(); }