Search code examples
androidandroid-animationandroid-4.0-ice-cream-sandwichandroid-2.3-gingerbread

Android app for all devices


I'm working on an app that is targeted for version 2.3 so that it will run on my sister's phone. However, I can run 4.0 on my phone. I want to add some swipe animations and such but I don't run the animations to run on her phone.

Is this even possible?


Solution

  • Yes, simply put the API specific code in a if/else block, so it is only called when the system supports it:

    Like this:

    if (currentapiVersion < android.os.Build.VERSION_CODES.JELLY_BEAN) {
    //do things that are only supported on JellyBean
    } else {
    //do the other stuff
    }