Is this the correct way to implement key-value pair for a Spinner in Android?
package com.mypackage
import android.app.Activity;
import android.os.Bundle;
i
To avoid reaching back into items[] from the listener use getItemAtPosition which returns an Object from the Adapter. To access the MyData methods you must cast the object like so:
public void onItemSelected(
AdapterView> parent, View view, int position, long id) {
MyData d = (MyData) parent.getItemAtPosition(position);
valueTextView.setText( d.getValue() );
}