Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a pop up menu in Android
    primarykey
    data
    text
    <p>i tried the following code </p> <pre><code>import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; import android.widget.EditText; import android.widget.ListAdapter; public class Custom_dialogActivity extends Activity { /** Called when the activity is first created. */ String test[] = {"Security","Data Backup","Missing Device"}; ListAdapter adapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(true); builder.setTitle("My Title"); builder.setInverseBackgroundForced(true); builder.setIcon(R.drawable.ic_launcher); builder.setItems(test, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub System.out.println("onClick " + which); } }); builder.setAdapter(adapter, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub System.out.println("DialogInterface : " + which); } }); EditText ed = new EditText(this); builder.setView(ed); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog,int which) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); } } </code></pre> <p>**but it looks like but i tried to set color and icon but failed to setIcon and Color Green on Top of Dialog box solve my problem and i didint created any xml and didnt made any changes ** </p> <p><img src="https://i.stack.imgur.com/6Kt0q.png" alt="enter image description here"></p> <p>but i want like </p> <p><img src="https://i.stack.imgur.com/UXhvI.jpg" alt="enter image description here"></p>
    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.
 

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