Hi i have a spinner that i have hidden using visibility = gone atribute. i call the spinner list using spinner.performclick() , this works fine except for that when selecting an item in the spinner list my onselect listener is never being called. please help:)
the only catlog warning being thrown is "window already focused, ignoring focus gain"
catagorySpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
CashDB cdb = new CashDB(getBaseContext());
cdb.open();
Cursor c = cdb.FetchCatagory(id);
startManagingCursor(c);
c.moveToFirst();
String newCatagoryName = c.getString(c.getColumnIndexOrThrow(CashDB.CATAGORY_NAME));
c.close();
areYouSureDialog("Are You Sure?", "Are you sure you want to delete the catagory " +'"'
+ catagoryName + '"'+ " and move all of the transactions to " +'"'
+ newCatagoryName + '"' + " ?",
catagoryIcon, catagoryName,newCatagoryName, DELETE_CATAGORY_MOVE, catagoryId);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
Leave the visibility for the spinner at INVISIBLE, but set the android:layout_width="0dp" and android:layout_height="0dp"
That way, the spinner is effectively not in the UI until you call performClick(), then it appears, user makes the choice and the spinner collapses back to 0x0 ... and you get the onItemSelected event.