Here's my code fragment:
import android.app.Activity;
import android.app.Bundle;
import android.app.ListActvity;
import android.app.ListView;
import android.app.AbsListView;
import android.app.AdapterView;
....
public class MyDemo extends ListActivity {
@Override public void onCreate(Bundle icicle) {
ListView myLV = (ListView) findViewByID(R.id.ListView1);
myLV.setChoiceMode(SINGLE_CHOICE_MODE);
}
}
When I try to compile, javac reports error: can't find symbol SINGLE_CHOICE_MODE. Any ideas? Am I not importing the correct file?
The CHOICE_MODE_SINGLE constant is a member of the ListView class. Correct usage:
myLV.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
You'll have to call the correct constant, which is CHOICE_MODE_SINGLE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With