Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code> AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); LinearLayout layout = new LinearLayout(this); LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); layout.setOrientation(LinearLayout.VERTICAL); layout.setLayoutParams(parms); layout.setGravity(Gravity.CLIP_VERTICAL); layout.setPadding(2, 2, 2, 2); TextView tv = new TextView(this); tv.setText("Text View title"); tv.setPadding(40, 40, 40, 40); tv.setGravity(Gravity.CENTER); tv.setTextSize(20); EditText et = new EditText(this); etStr = et.getText().toString(); TextView tv1 = new TextView(this); tv1.setText("Input Student ID"); LinearLayout.LayoutParams tv1Params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); tv1Params.bottomMargin = 5; layout.addView(tv1,tv1Params); layout.addView(et, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); alertDialogBuilder.setView(layout); alertDialogBuilder.setTitle(title); // alertDialogBuilder.setMessage("Input Student ID"); alertDialogBuilder.setCustomTitle(tv); if (isError) alertDialogBuilder.setIcon(R.drawable.icon_warning); // alertDialogBuilder.setMessage(message); alertDialogBuilder.setCancelable(false); // Setting Negative "Cancel" Button alertDialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); // Setting Positive "OK" Button alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (isError) finish(); else { Intent intent = new Intent(ChangeDeviceActivity.this, MyPageActivity.class); startActivity(intent); } } }); AlertDialog alertDialog = alertDialogBuilder.create(); try { alertDialog.show(); } catch (Exception e) { // WindowManager$BadTokenException will be caught and the app would // not display the 'Force Close' message e.printStackTrace(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload