title: Convert String to item number, then pass to activity to API
body: <p>I'm developing an Android app. I have a spinner that I can find what item was selected from it. I need to be able to match up the item selected to a number, and then pass that off to another activity to perform an API request. I'm not sure how to do this. I've looked for solutions to this problem, but I haven't found very clear instructions that I can follow. I found that I could use <code>Map&lt;String, String&gt;</code> to do the matching part, but how can I retreive the number of the one selected from that? Would I just search inside the Array for <code>SelectedValue</code>, and how would that be done? I know that I can do <code>startActivityforResult();</code> to transfer the number to the next activity. I also am not sure how to add that <code>number</code> to the url, like <a href="http://google.com/" rel="nofollow">http://google.com/</a><code>number</code>. My code is below:</p>
  
  <p><strong>Part of TestStation.java</strong></p>
  
  <pre><code>        Spinner2.setOnItemSelectedListener(new OnItemSelectedListener() {
  
          public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                  int arg2, long arg3) {
              // TODO Auto-generated method stub
  
                  String selectedValue = arg0.getItemAtPosition(arg2).toString();
                  int[] Yellow_ID = getResources().getIntArray(R.array.Yellow_ID);
                  int[] Yellow_Li = getResources().getIntArray(R.array.Yellow_Line);
  
                  HashMap&lt;Integer, Integer&gt; myMap = new HashMap&lt;Integer, Integer&gt;();
                  for (int i = 0; i &lt; Yellow_Line.length(); i++) {
                      myMap.put(Yellow_Li[i], Yellow_ID[i]);
                  }
  
  
  
  
          }
  
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
              // TODO Auto-generated method stub
  
          }
      });
  
  
  }
  </code></pre>
  
  <p>Thank you for your help.</p>