title: Persist checked status of items in ListView
body: <p>I have a <code>ListView</code> of <code>CheckedTextView</code> items, each one uses a radio button. It is a single-choice list indicating a now-playing audio stream in my main activity. </p>
  
  <p>Once one of the items is checked it should remain checked until another item is checked, or until the users 'stops' the stream from a notification or the UI, and the checked status needs to be reset every time the application is quit.</p>
  
  <p>At the minute I'm doing this:</p>
  
  <pre><code>final BookmarkAdapter adapter = new BookmarkAdapter(this, db.getAllBookmarks());
  final ListView listView = findViewById(R.id.bookmark_list_view);
  
  listView.setAdapter(adapter);
  listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
          View v = listView.getChildAt(position);
          CheckedTextView ctv = v.findViewById(R.id.bookmark_list_item);
          ctv.toggle();
          // ... go on to launch a service and another activity
      }
  });
  </code></pre>
  
  <p>You can see that the item is being checked when you select the list item, before my other activity opens. However, when I return to the main activity, no item is checked any more. </p>
  
  <p>What is the correct way to persist the checked state of the items until the application is closed or I uncheck it manually?</p>
  
  <p>The ListView xml:</p>
  
  <pre><code>&lt;ListView
          android:id="@+id/bookmark_list_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:choiceMode="singleChoice"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent" /&gt;
  </code></pre>
  
  <p>The CheckedTextView xml:</p>
  
  <pre><code>&lt;CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/bookmark_list_item"
          android:layout_width="match_parent"
          android:layout_height="?android:attr/listPreferredItemHeight"
          android:checkMark="?android:attr/listChoiceIndicatorSingle"
          android:gravity="center_vertical"
          android:paddingLeft="16dip"
          android:paddingRight="16dip"
          android:text="@string/list_item_title"
          android:textAppearance="@style/TextAppearance.AppCompat.Medium" /&gt;
  </code></pre>