No text is being set when I select any item from a spinner. What might be the error?
ArrayAdapter<String> pSelectAdapter = new ArrayAdapter<String>(PCreate.this,android.R.layout.simple_spinner_item, pNames);
pSelectAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
selectP.setAdapter(pSelectAdapter);
selectP.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
String nameSelected = pNames.get(arg2);
pID = pMatch.get(nameSelected);
p.setText(nameSelected);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
I think here you missed to create the object of View class, Please match this line with your code, and make this change, This may help you..