Addev
Addev

Reputation: 32243

Backward compatibility and SDK updates in Android

Since I need the AsyncTask.executeOnExecutor() function targeting the SDK level 7 I've took the last ASyncTask code and created a mAsyncTask class.

I'd like to use mAsyncTask if the API level is < 11 and the Android's default AsyncTask (in order to seize the future SDK updates.

Since the definition of an AsyncTask extension can take a lot of lines. It is ugly and hard maintainable to copy/paste and make one extend of each class (mAsyncTask and AsyncTask) and then in run-time execute one or the other.

Is there a trick I could use for avoiding this problem?

Thanks

Upvotes: 2

Views: 93

Answers (1)

Philippe Girolami
Philippe Girolami

Reputation: 1876

Since you can't subclass the "real" AsyncTask using relfexion, the only way is to create separate APKs.

Upvotes: 1

Related Questions