How to display the vaule(dependent value) when we select one item form the list of values in Android SDK?
<p>Am new to this Android SDK platform,so could you people help me out to solve my issue.
so lets discuss brief about my issue, am developing small application in which am using sppiner to list all country states and zip codes so my question is when i select one country state in a list it should automatically populate and display its corresponding zip code </p>

<p><strong>below is my main.xml file</strong> 



     
         
    
  
  
   
    

<pre><code> android:layout_centerHorizontal="true"
 android:layout_marginTop="2dp"
 android:padding="12dip"
 android:layout_height="40dip"
 android:layout_marginRight="20dip"
 /&gt;
</code></pre>

<p>
</p>

<p><strong>here is my Activity class</strong></p>

<p>import android.app.Activity;</p>

<p>import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.AdapterView.OnItemSelectedListener;</p>

<p>public class EriePremium extends Activity {
    /** Called when the activity is first created. */</p>

<p>@SuppressWarnings("unchecked")
 @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);</p>

<pre><code>    Spinner s = (Spinner) findViewById(R.id.spinner); 
    ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.States, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    s.setAdapter(adapter);

Spinner s1 = (Spinner) findViewById(R.id.spinner1); 
ArrayAdapter adapter1 = ArrayAdapter.createFromResource(this, R.array.Zip, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
s1.setAdapter(adapter1); 
}
</code></pre>

<p>}</p>

<p><strong>and my array list array.xml file</strong></p>

<p>


        Alabama
        Alaska<br>
        American Samoa<br>
        Arizona<br>
        Arkansas<br>
        California<br>
        Colorado<br>
        Connecticut<br>
        Delaware
        District of Columbia<br>
        Florida<br>
        Georgia<br>
        Guam<br>
        Hawaii<br>
        Idaho<br>
        Illinois<br>
</p>

<p>
        1001<br>
        1002<br>
        1003<br>
        1004<br>
        1005<br>
        1006<br>
        1007<br>
        1008
        1009<br>
        1010<br>
        1011<br>
        1012<br>
        1013<br>
        1014<br>
        1015<br>
        1016
<br>
</p>

<p>Awaiting for response</p>

<p>Thanks in advance,
Madhu</p>
