Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8653061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:27:09+00:00 2026-06-12T14:27:09+00:00

The latest Android APIs have some helpful methods that are not available to older

  • 0

The latest Android APIs have some helpful methods that are not available to older Android versions. The DatePicker, for example, has a new method called setCalendarViewShown() that is not available for old APIs such as Android 2.2 (level 8) and so on.

However, I’ve set the minimum API level to 8 and the target level to 16. So I would like to use these methods if available (on level 11+ devices).

Now I’ve tried to distinguish between several API levels programatically and, if available, call the method like this:

if (android.os.Build.VERSION.SDK_INT >= 11) {
    datePicker.setCalendarViewShown(false);
}

Is this approach okay? In Eclipse, there’s just some warnings, but they can be suppressed, of course. Due to checking for the SDK_INT, this code should be fine and cause no problems, shouldn’t it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:27:10+00:00Added an answer on June 12, 2026 at 2:27 pm

    Is this approach okay?

    I’d use Build.VERSION_CODES.HONEYCOMB instead of 11 for readability, but otherwise yes.

    In Eclipse, there’s just some warnings, but they can be suppressed, of course.

    Eclipse will point out that setCalendarViewShown() does not exist in API Level 8. It has no reliable means of confirming that you are only calling that method within a version guard block, so it just complains. Using the TargetApi(11) annotation will get rid of it, while still ensuring that if you add something else to the method that needs something higher than 11, you will get warned again.

    Due to checking for the SDK_INT, this code should be fine and cause no problems, shouldn’t it?

    Yes.

    BTW, in this particular case, there’s an XML attribute you could use (android:calendarViewShown) to replace the call. As XML attributes are automatically ignored on older versions, you could then skip the Build check.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I went ahead and installed the latest Android Plug-in for Netbeans not realizing that
Is it just me or is anyone else not seeing the latest Android (Jellybean)
I am trying out the (latest) Android SDK, and noticed some strange behavior. I've
I have an Android application that allows the user to connect to his Facebook
I am developing a mobile site and have noticed that on android all the
I do have the latest Android API and a ICS emulator running, but I
I have an Android Activity that displays Google Maps through MapView control and extending
Anyone know where I can find what Android APIs are supported in the latest
It seems that also the latest android SDK tools still don't properly support testing
I have installed the latest android sdk (android-sdk_r10-windows.zip), latest eclipse helios (eclipse-jee-helios-SR2-win32.zip) and latest

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.