title: How set selection in spinner of some string if spinner contains the same?
body: <p>I posted similar question recently but nobody helped me. So I'll try to explain my problem better than before.</p>
  
  <p>So I read some text from one file (this file may include more words) and then I read text from second file (this file always includes one word which is the same as one word in first file). Text in both files may be different everytime.</p>
  
  <p>So for example:</p>
  
  <p>First string contains: <strong>black blue yellow red green</strong></p>
  
  <p>Second string contains: <strong>yellow</strong></p>
  
  <p>Then I make spinner from first string, so spinner contains in this example these words (black blue yellow red green), so default option is black (coz it is first in my array), but I need to make third position as default in my spinner in this example, because second string contains yellow and yellow is on the third position in my spinner.</p>
  
  <p><strong>How can I make it without repopulating spinner?</strong></p>
  
  <p><strong>btw. these strings are only example. Files may always includes different words than before.</strong></p>
  
  <p><strong>Solution:</strong></p>
  
  <pre><code>s1.setSelection(getIndex(s1, prefNameCurGOV));
  </code></pre>
  
  <p>and then:</p>
  
  <pre><code>private int getIndex(Spinner s1, String prefNameCurGOV){
  
          int index = 0;
  
          for (int i=0;i&lt;s1.getCount();i++){
              if (s1.getItemAtPosition(i).equals(prefNameCurGOV)){
                  index = i;
              }
          }
          return index;
  </code></pre>