I have an ExpandableListView with a custom adapter (lets say in class A), and I need to call setListAdapter(mAdapter)
from another class (class B), from a Service specifically.
mAdapter = new Refeicao.MyExpandableListAdapter();
setListAdapter(Refeicao.mAdapter);
From similar questions in stackoverflow I tried some solutions, such as:
-1 putting that code into a static method in Class A in order to call it from B - but got the non-static method reference "error"
-2 View listView = getActivity().findViewById(R.id.list); - don't work I suppose because the Service is not an activity
-3
The method setListAdapter(ExpandableListAdapter) is undefined for the type
static ExpandableListView lv;
lv = (ExpandableListView) findViewById(android.R.id.list);
and then
mAdapter = new A.MyExpandableListAdapter();
A.lv.setListAdapter(mAdapter);
I get: the method setListAdapter(ExpandableListAdapter) is undefined for the type ExpandableListView.
Anyway, there's any way to solve my problem?