Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with android single choice dialog using arrayAdapter
    primarykey
    data
    text
    <p>I tried to do a custom single choice dialog using an ArrayAdapter. First i created a Array Adapter with anonymous class.</p> <pre><code>private final Dialog createListFile(final String[] fileList) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.compare); ArrayAdapter&lt;String&gt; dialogArrayAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.dialog_row, fileList) { @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolderDialog holder = null; if (convertView == null) {are LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.dialog_row, null); holder = new ViewHolderDialog(); holder.date = (TextView) convertView.findViewById(R.id.dialogDate); holder.days = (TextView) convertView.findViewById(R.id.dialogDays); convertView.setTag(holder); } else { holder = (ViewHolderDialog) convertView.getTag(); } String item = getItem(position); holder.date.setText(item); holder.days.setText("giorni"); return convertView; } }; </code></pre> <p>Then i called the setSingleChoiceItems method of the builder to create a list of items with a check mark displayed; passing as the first parameter arrayAdapter created earlier.</p> <pre><code>builder.setSingleChoiceItems(dialogArrayAdapter, -1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { n = whichButton; } }); </code></pre> <p>The problem is that when I run the code shows the check mark. Where am I doing wrong?</p>
    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.
    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