Sunday, December 6, 2009

[android-developers] can't access AlertDialog list items

How can I access items I previously set using AlertDialog.Builder?

private static final CharSequence[] skill_levels = { "Rookie",
"Average", "Expert" };

skillLevelBuilder = new AlertDialog.Builder( this );
skillLevelBuilder.setTitle( "Change Skill Level" );
skillOnClick = new DialogInterface.OnClickListener()
{
[...]
}
skillLevelBuilder.setItems( skillLevels, skillOnClick );


I need to disable some of the items so they are visible but not selectable.


I am trying (and failing) like this:

AlertDialog skillLevelAlert = skillLevelBuilder.create();
ListView lv = skillLevelAlert.getListView();
View v = (View) lv.getItemAtPosition( 0 );
v.setEnabled( false );
skillLevelAlert.show();

v is always null. How can I get an item to disable it?

Thanks,

--
Greg Donald
http://destiney.com/

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate