title: Have at least one item selected in Android MultiSelectListPreference
body: <p>I have search now for hours through the internet and have found nothing substantial so far. The thing that I want to do is a multi choice preference view, that disables the last item and reenables it, if it is not alone anymore.</p>
  
  <p>I through so far about taking the super class force read the private variables in there to write my own <code>onPrepareDialogBuilder(AlertDialog.Builder builder)</code>. Which is configuring its own <code>OnMultiChoiceClickListener</code> that jumps in, in the moment where has only one item left. The problem here is, that I use a bad practice force read of a private variable and that I have so far no idea how to get the checkbox item and how to disable it. But I think looking even deeper into the Android SDK will solve this problem. </p>
  
  <p>At the end, if nothing works, solving the problem with doing an overwrite the <code>OnPreferenceChangeListener</code> to display a toast if the user has less than one item selected. But user friendliness is a high value, that needs to be earned and that often isn't easy.</p>
  
  <p>Thx.</p>
  
  <pre><code>import android.content.Context;
  import android.preference.MultiSelectListPreference;
  import android.util.AttributeSet;
  
  import java.util.ArrayList;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Set;
  
  import georg.com.flironetest_01.Variables.Units;
  
  /**
   * Created by Georg on 16/03/16.
   */
  public class UnitMultipleSelectorPreference extends MultiSelectListPreference {
  
      public UnitMultipleSelectorPreference(Context context, AttributeSet attrs) {
          super(context, attrs);
  
          List&lt;CharSequence&gt; humanU = new ArrayList&lt;&gt;();
          List&lt;CharSequence&gt; machineU = new ArrayList&lt;&gt;();
  
          Units[] all = Units.values(); // Units is a enum with a rewriten to string statement.
          for (Units elem : all) {
              humanU.add(elem.toString());
              machineU.add(elem.name());
          }
  
          setEntries(humanU.toArray(new CharSequence[humanU.size()]));
          setEntryValues(machineU.toArray(new CharSequence[machineU.size()]));
  
          Set&lt;String&gt; mU = new HashSet&lt;&gt;();
          mU.add(Units.C.name());
          mU.add(Units.K.name());
  
          setDefaultValue(mU);
      }
  }
  </code></pre>