我正在編輯我的帳戶的屏幕。選擇適當的價值的微調accroding我的類
我的帳戶類有一些屬性。現在我想顯示這些屬性,然後編輯它們。 我做了一個顯示賬戶類型的微調。
現在我使用此代碼
ArrayAdapter<CharSequence> 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<?> 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();
}
這段代碼實際上而不是顯示myAccount.accountType
,套spinner
第一元素作爲我的賬戶accountType
。
我怎樣才能不顯示的typeOfAccountArray
數組的第一個項目但myAccount
accountType
,然後我可以編輯,並相應地改變它。
問候