ExpandableListAdapter
is an interface, it cannot be instantiated. You should use SimpleExpandableListAdapter
or extends
BaseExpandableListAdapter
and override its methods if you want more flexibility.
ExpandableListAdapter cannot be resolved to a type
-
02-10-2022 - |
Frage
i have done this on my other android app and it worked flawlessly but when i do this in another app it doesnt work.
i keep getting an error saying "ExpandableListAdapter cannot be resolved to a type"
public class MainActivity extends Activity implements AdListener,
OnClickListener {
ExpandableListAdapter listAdap;
ExpandableListView expListView;
List<String> listDataHeader;
HashMap<String, List<String>> listDataChild;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Full Screen
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
// get the list view
expListView = (ExpandableListView) findViewById(R.id.lvExp);
prepareListData();
listAdap = new ExpandableListAdapter(this, listDataHeader, listDataChild);
// setting list adapter, show the list
expListView.setAdapter(listAdap);
expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent,
View v, int groupPosition, int childPosition,
long id) {
}
});
}
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow