So, I was reading this earlier question for ideas on how to allow me to click an item in a list to do one action or long-press that item to switch to an ActionMode where I can select multiple items and use the ActionBar to do something to those items. However, I'm having issues with this answer. Specifically, I'm implementing this into a SherlockListFragment (using ActionBarSherlock). However, the moment I declare a new MultiChoiceModeListener, Eclipse throw up a couple of compile errors.
Description Resource Path Location Type
Cannot override the final method from SherlockListFragment DateTimeListFragment.java /path/to/my/project line 127 Java Problem
The method inflate(int, Menu) in the type MenuInflater is not applicable for the arguments (int, Menu) DateTimeListFragment.java /path/to/my/project line 125 Java Problem
These go away the moment I remove the MultiChoiceModeListener. I have no idea what could be causing it, as there's nothing odd going on that I'm aware of.
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
{
//super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.alarmsmenu, menu); //line 125
}
public boolean onOptionsItemSelected(MenuItem Item) //line 127
{
switch(Item.getItemId())
{
case R.id.addAlarm:
addAlarm();
return true;
case R.id.editAlarms:
return true;
default:
return super.onOptionsItemSelected(Item);
}
}
I'm very confused. Why does implementing MultiChoiceModeListener mean I can't override OnOptionsItemSelected?
EDIT: To help clarify, here are my imports.
import java.util.Calendar;
import java.util.GregorianCalendar;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.*;
import android.support.v4.content.Loader;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView.MultiChoiceModeListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.DatePicker;
import android.widget.ListView;
import android.widget.TimePicker;
import com.actionbarsherlock.app.SherlockListFragment;
import com.actionbarsherlock.app.ActionBar; //Yes, it's unused...
import com.actionbarsherlock.view.*;
import com.commonsware.cwac.loaderex.acl.*;