I have a custom adapter populating a listview.
Each row has a checkbox which has an OnCheckedChangeListener set in the getView() method.
All is working in that regard, however I want to open the options menu in my activity that is ‘hosting’ my listview from the event listener in the Adapter.
I’ve tried passing in an instance of my Activity to no avail and I can’t access a static method with openOptionsMenu() in my Activity from the Adapter class because openOptionsMenu() is non-static.
Any ideas?
I’m assigning my adapter like so,
mAdapter = new CustomFileAdapter<String>(this, filenames, this); (context, array, activity)
And the constructor in the Adapter like so,
public CustomFileAdapter(Context context, String[] images, Activity a)
Solved this by just creating a callback in the Adapter class to notify my main activity.