Reputation: 4120
I'm running into a couple of problems getting started with Actionbar Sherlock 4.0. I followed the steps in http://www.youtube.com/watch?feature=player_embedded&v=4GJ6yY1lNNY which seems very clear, but I can't get it to build cleanly.
The first problem relates to my Activity's overrides of onCreateOptionsMenu() and onOptionsItemSelected(). I understand from Unable to override onCreateOptionsMenu in ListFragment that the imports need to be changed from
import android.view.Menu;
import android.view.MenuItem;
to
import android.support.v4.view.Menu;
import android.support.v4.view.MenuItem;
but Eclipse is not picking up the new Menu and MenuItem definitions, even though I've put android-support-v4.jar into my project's libs directory. Any ideas why this isn't working?
Second, the set up tutorial says it's OK to build Actionbar Sherlock using Android SDK 4.0, ... but I also saw that both Actionbar Sherlock and your project must be compiled with Android SDK 3.2 for proper support (in use ActionBarSherlock library, error after use sherlock as library). Can anyone clarify if the older SDK is in fact required?
Many thanks!
Upvotes: 1
Views: 4986
Reputation: 1006594
I understand from Imposssible to override onCreateOptionsMenu in ListFragment that the imports need to be changed
Yes, but there are ActionBarSherlock versions of those classes that you should be using, not the Android Support package ones:
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
but Eclipse is not picking up the new Menu and MenuItem definitions, even though I've put android-support-v4.jar into my project's libs directory
You should be getting the Android Support package from the ActionBarSherlock library project.
Can anyone clarify if the older SDK is in fact required?
No, you need to set your build target to Android 4.0 or higher. The comment you see on that question was for an earlier version of ActionBarSherlock.
Upvotes: 6