Tuesday, June 22, 2010

[android-developers] Spinner selection dialog without spinner

I have a spinner selection box on my activity, but now I want to
remove the spinner from the main view and make the selection available
by an option from the menu button. How do I get the dialog the spinner
shows if I click it without having the spinner?

Currently I fill the spinner using a SimpleCursorAdapter like this:

Cursor c = db.fetchAllSets();
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_spinner_item,
c,
new String[] { DatabaseAdapter.SET_KEY_NAME },
new int[] { android.R.id.text1 });

adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mSetsSpinner.setAdapter(adapter);


So now I'm planning to remove the spinner from my activity, add a new
button to the menu and in the onOptionsItemSelected(...) show a dialog
with the list of available selection - just the way it is right now
after clicking the spinner object.

Every help is appreciated!
Thanks

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment