Comparing string array with string and posting my result to main.xlm
<p>I am having trouble with understanding how to compare strings in Java for Android.  I have written code to do this in JavaScript and Palm but am new to Java and am a little confused.  Case in point, I am trying to modify the example on the Android Developers site for SpinnerActivity (http://developer.android.com/resources/samples/Spinner/src/com/android/example/spinner/SpinnerActivity.html).  In my application I am looking at pipe sizes in the spinner not planets.  When the user picks a pipe size I want to reference an array of pipe sizes and be able to pick other parameters associated with that pipe size like the outside diameter (OD) of the pipe.  I have modified the above sample code and added and array for the pipe sizes and the OD sizes.  I then try to compare what the user picked in the pipe sizes spinner with my pipe sizes array and use the number of the array that matches to pick the associated OD.  There is something wrong with the way I am trying to make this comparision.  I set both of these values as stings but they never seem to find one another.</p>

<p>HelloSpinner1.java section I have changed is:</p>

<pre><code>       public void onItemSelected(AdapterView&lt;?&gt; parent, View v, int pos, long row) {

            HelloSpinner1.this.mPos = pos;
            HelloSpinner1.this.mSelection = parent.getItemAtPosition(pos).toString();
            /*
             * Set the value of the text field in the UI
             */
            TextView resultText = (TextView)findViewById(R.id.SpinnerResult);
            resultText.setText(HelloSpinner1.this.mSelection);

            String[] OD;              // array of pipe ODs
            OD = new String[30];      // allocates memory for 30 floating point numbers
            OD[0] = "0.405";
            OD[1] = "0.540";
            OD[2] = "0.675";
            OD[3] = "0.840";
            OD[4] = "1.050";
            OD[5] = "1.315";
            OD[6] = "1.660";
            OD[7] = "1.9";
            OD[8] = "2.375";
            OD[9] = "2.875";
            OD[10] = "3.5";
            OD[11] = "4";
            OD[12] = "4.5";
            OD[13] = "5.563";
            OD[14] = "6.625"; 
            OD[15] = "8.625";
            OD[16] = "10.750";
            OD[17] = "12.75";
            OD[18] = "14";
            OD[19] = "16";
            OD[20] = "18";
            OD[21] = "20";
            OD[22] = "22";
            OD[23] = "24";
            OD[24] = "26";
            OD[25] = "28";
            OD[26] = "30";
            OD[27] = "32";
            OD[28] = "34";
            OD[29] = "36";


String [] Size;
Size = new String [30];
            Size[0] = "1/8";
            Size[1] = "1/4";
            Size[2] = "3/8";
            Size[3] = "1/2";
            Size[4] = "3/4";
            Size[5] = "1";
            Size[6] = "1-1/4"; 
            Size[7] = "1-1/2";
            Size[8] = "2";
            Size[9] = "2-1/2";
            Size[10] = "3";
            Size[11] = "3-1/2";
            Size[12] = "4";
            Size[13] = "5";
            Size[14] = "6";
            Size[15] = "8";
            Size[16] = "10";
            Size[17] = "12";
            Size[18] = "14";
            Size[19] = "16";
            Size[20] = "18";
            Size[21] = "20";
            Size[22] = "22"; 
            Size[23] = "24";
            Size[24] = "26";
            Size[25] = "28";
            Size[26] = "30";
            Size[27] = "32";
            Size[28] = "34";
            Size[29] = "36"; 



            String ODSize;

            for (int i = 0; i  &lt;= 29; i++){
                    if (Size.equals("HelloSpinner1.this.mSelection")) {
                    ODSize = OD[i];
                    break;
                     }
                }  

        }
</code></pre>

<p>The associated strings.xml rorm the android site with slight modifications is:</p>

<p></p>



<p>

    Pipe and Tube<br>
    
        1/8
        1/4
        3/8
        3/4
        1
        1-1/4
        1-1/2
        2
        2-1/2
        3
        3-1/2
        4
        5
        6
        8
        10
        12
        14
        16
        18
        20
        22
        24
        26
        28
        30
        32
        34
        36
    
    Select a Pipe Size
</p>
