Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Compiler error: can't find (SINGLE_CHOICE_MODE);

Tags:

android

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?

like image 666
JB_User Avatar asked May 04 '26 13:05

JB_User


2 Answers

The CHOICE_MODE_SINGLE constant is a member of the ListView class. Correct usage:

myLV.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
like image 107
slezica Avatar answered May 07 '26 01:05

slezica


You'll have to call the correct constant, which is CHOICE_MODE_SINGLE.

like image 43
keyboardsurfer Avatar answered May 07 '26 01:05

keyboardsurfer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!