selecting proper value of spinner accroding to my Class
<p>i am making an edit Screen of my Account.</p>

<p>My account class has some properties. Now i want to show these properties and then edit them.
I Have made a spinner that shows the account type.</p>

<p>Right now i am using this code</p>

<pre><code> ArrayAdapter&lt;CharSequence&gt; typeOfAccountAdapter = ArrayAdapter.createFromResource(
                        this, R.array.typeOfAccountArray, android.R.layout.simple_spinner_item);
                adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
               typeOfAccount.setAdapter(typeOfAccountAdapter); 

                typeOfAccount.setOnItemSelectedListener(new OnItemSelectedListener() 
                 {
                    @Override
                    public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,int arg2, long arg3) 
                    {
                        if (typeOfAccount.getSelectedItem().toString().equals("Income"))
                            myAccount.accountType = AccountType.kAccountTypeIncome;
                        else if(typeOfAccount.getSelectedItem().toString().equals("Asset"))
                            myAccount.accountType = AccountType.kAccountTypeAsset;
                        else if(typeOfAccount.getSelectedItem().toString().equals("Cash"))
                            myAccount.accountType = AccountType.kAccountTypeAssetCash;
                        else if(typeOfAccount.getSelectedItem().toString().equals("Bank"))
                            myAccount.accountType = AccountType.kAccountTypeAssetBank;
                        else if(typeOfAccount.getSelectedItem().toString().equals("Liability"))
                            myAccount.accountType = AccountType.kAccountTypeLiability;
                        else
                            myAccount.accountType = AccountType.kAccountTypeLiabilityOther;
                        setStrDeatilOfAccount();
                    }
</code></pre>

<p>This code actually instead of displaying <code>myAccount.accountType</code>, sets the first element of <code>spinner</code> as <code>accountType</code> of my account.</p>

<p>How can i display not the first item of array of <code>typeOfAccountArray</code> but <code>accountType</code> of <code>myAccount</code></p>

<p>And then i can edit and change it accordingly.</p>

<p>Best Regards</p>
