Support multiple sdk-version in one release (Android or others Java based platform)


I just think it’s could be useful to share the new java notion I just learned to fix the study case below:

how to handle multiple sdk version in one release on Android?

I’m building a camera app right now for my company, then I want to handle front and back camera, and others camera capacities which could not be available on the current SDK.

So how could I make my right import without crashing the VM?

Very simple answer here:

Static classes are not loaded by the VM until one his method is called.

So what you need to do is implement a singleton pattern, through an abstract class, which will choose the static class to call.  So graceful right?

You can find an implementation example here:

Find real and full explanation on wiki here:



1 Comment

  1. vd11

    you…you’re alive ?? it’s incredible !! 😉
    So what’s up man ?? you work on android now ? Give news, it will be nice 🙂
    a bientot mec

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: