ListView default selected row OnActivityCreated help

Greg.8674Greg.8674 USMember ✭✭

I have a listview fragment that I populate during OnActivityCreated(). I am trying to have a default row selected but cant seem to do it.

//I bind the ListAdapter to a List<>
this.ListAdapter = new ArrayAdapter(Activity, Android.Resource.Layout.SimpleListItemSingleChoice, langList);

// tell the listview the choicemode type.
this.ListView.ChoiceMode = ChoiceMode.Single;

// try and have a default row selected by an int set from a sqllite query
int defaultIndex = iSomeDefaultNumberSetSomewhereElse;

//neither of these 2 work for setting a default selected row.
this.ListView.SetItemChecked(defaultIndex, true); // this works on the OnListItemClick event of a row
this.ListView.SetSelection(defaultIndex); // ???

What's needed to have a default row selected after I bind the ListAdapter with my data?

thanks in advance!

Sign In or Register to comment.