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 8495587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:36:51+00:00 2026-06-10T23:36:51+00:00

I have noted in the Android Market that many popular applications have backward compatibility

  • 0

I have noted in the Android Market that many popular applications have backward compatibility to much earlier versions of Android.
E.g.

Evernote - 1.6
Faceobook Messenger - 2.2

These applications look and work great but how can they do this and support much older API levels? Are they only using API features that exist in the lowest supported OS version, hardly? I’m assuming they must be using some features of the later API levels to provide a great UI and featurelist.

I can see two possible solutions:

Use Min/Target API levels in build. Then through code you check the OS version and implement the features using a supported method and degrade gracefully. This seems like a lot of work.

Have multiple app versions targeting various OS versions. E.g. A release for 2.2 and another for 4.0. Is this possible?

The reason for asking is I am planning a new app that should support 2.2 but I fear I may require API features that are only available in later releases? Should I just target 2.2?

EDIT: Also, what role do Compatibility Libraries play? Is this the key?

Thanks.

  • 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-10T23:36:52+00:00Added an answer on June 10, 2026 at 11:36 pm

    We (Evernote) do extra work to support 1.6 and use as many new API’s as we can. The main problem with supporting 1.6 is that Dalvik does a greedy search on your classes. This makes it impossible to use code like

    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        prefEditor.apply();
    } else {
        prefEditor.commit();
    }
    

    Because it would throw a class verification error. This is caused when dalvik sees your method and tries to access it at runtime.

    Instead you need to use a helper class to instantiate the appropriate class for the SDK. Yes this is much more work

    public abstract class SharedPreferenceEditor {
    
      private static SharedPreferenceEditor sInstance;
    
      public static SharedPreferenceEditor getInstance() {
        if (sInstance == null) {
    
          /*
          * Check the version of the SDK we are running on. Choose an
          * implementation class designed for that version of the SDK.
          */
          @SuppressWarnings("deprecation")
          int sdkVersion = Build.VERSION.SDK_INT;
          if(Evernote.DEBUG)Log.d("SharedPreferenceEditor", "sdkVersion=" + sdkVersion);
          if (sdkVersion < Build.VERSION_CODES.GINGERBREAD) {
            sInstance = new CommitSharedPreferenceEditor();
          } else  {
            sInstance = new ApplySharedPreferenceEditor();
          }
        }
        return sInstance;
      }
    
      public abstract void save(SharedPreferences.Editor editor);
    }
    

    Then you have one for the gingerbread + api level

    public class ApplySharedPreferenceEditor extends SharedPreferenceEditor {
      public void save(SharedPreferences.Editor editor) {
        editor.apply();
      }
    }
    

    and one for the < gingerbread level

    public class CommitSharedPreferenceEditor extends SharedPreferenceEditor{
      public void save(SharedPreferences.Editor editor) {
        editor.commit();
      }
    }
    

    I’d recommend supporting 2.1 and up so than you can take advantage of the improvements to Dalvik and use the first example I listed.

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

Sidebar

Related Questions

I have noted that in my computer Android and Eclipse are very slow. I
As another post I've made noted, I don't have much experience with jQuery, and
I have implemented an Android code that calls a SOAP web service. The web
I have built and Android app (not in the Market yet) and I am
We have mobile applications on iPhone and Android (and soon to be released Blackberry).
I have been storing a global variable that's needed across Activities in my Android
I have noted the following from a website: The JVM HotSpot memory is split
While transforming some data to SQL Azure, I have noted an unexpected behavior. I
Android 2.2 release notes have just been released. ActivityManager.restartPackage method has been deprecated and
I have a ListActivity whose layout looks like <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent

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.