4

I have an Android application that targets API 17 and has a minimum SDK version of 8. I'm not interested in providing the ActionBar in devices with Android API < 11, but I'd like to use in the devices running Android >= 3.0.

Browsing stackoverflow in order to learn how to do so, I stumbled upon this question: How to code backward compatible new feature in Android SDK?. I wanted to use the implementation provided in its answer, but I can't import android.app.ActionBar. Eclipse would not recognise it.

What could be the problem? Thanks in advance.

Community
  • 1
  • 1
Iris
  • 291
  • 5
  • 10

3 Answers3

5

Make sure that your project is referencing the android.jar file for the target, rather than the minimum SDK.

In eclipse, right click project -> Build Path -> Configure Build Path, and see which Android version is referenced there.

syklon
  • 187
  • 6
  • 9
0

Why not use action bar sherlock ?

Ercan
  • 3,705
  • 1
  • 22
  • 37
  • I'm working on an app that was only meant for handsets, so it has a whole layout not considering the action bar (since it's minimum SDK version is 8). Now I'm designing a new layout for tablets. That's why I don't need Action Bar support for Android versions earlier than 3.0. If I ever decide to unify both layouts (handset version and tablet version) I'll use ActionBarSherlock. Thanks. – Iris Jan 19 '13 at 15:27
0

As mentioned here

Beginning with Android 3.0 (API level 11), the action bar appears at the top of an activity's window when the activity uses the system's Holo theme (or one of its descendant themes), which is the default. You may otherwise add the action bar by calling requestFeature(FEATURE_ACTION_BAR) or by declaring it in a custom theme with the windowActionBar property.

Varun Bhatia
  • 4,326
  • 32
  • 46