Note that there are some explanatory texts on larger screens.

plurals
  1. POAlertDialog doesn't display items from ListAdapter Hide options
    primarykey
    data
    text
    <p>When I try to set the Alert using ArrayAdaptor to display a set of items, the list is displayed but the items' characters are invisible. If the item is selected, then the characters are visible. Scratching my head on why. Appreciate any advice. Below is the code and the screenshot from the emulator. </p> <pre><code>public class MessageTest extends Activity implements View.OnClickListener { public final static String debugTag = "MessageDemo::"; Button alert; Button toast; String[] items={"item1", "item2", "item3", "item4", "item5" }; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.message); alert=(Button)findViewById(R.id.alert); alert.setOnClickListener(this); } public void onClick(View view) { if (view==alert) { ArrayAdapter&lt;String&gt; aa = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_single_choice, items); new AlertDialog.Builder(this) .setTitle("MessageTest") .setSingleChoiceItems(aa, 0, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int which) { Log.d(MessageDemo.debugTag, "DialogInterface.OnClickListener::onClick() is called -&gt; which = "+which); } }) .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sumthin) { Log.d(MessageDemo.debugTag, "OK button is clicked -&gt; sumthin = "+sumthin); } }) .setNeutralButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sumthin) { Log.d(MessageDemo.debugTag, "Close button is clicked -&gt; sumthin = "+sumthin); // do nothing -- it will close on its own } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sumthin) { Log.d(MessageDemo.debugTag, "Cancel button is clicked -&gt; sumthin = "+sumthin); } }) .show(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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