1 package org.openintents.filemanager.compatibility;
\r
3 import android.content.res.Resources;
\r
4 import android.graphics.Bitmap;
\r
5 import android.graphics.drawable.BitmapDrawable;
\r
7 public class BitmapDrawable_Compatible {
\r
9 private static boolean use_SDK_1_6 = true;
\r
12 * Replaces "new BitmapDrawable(context.getResources(), bitmap)" available only in SDK 1.6 and higher.
\r
18 public static BitmapDrawable getNewBitmapDrawable(Resources resources, Bitmap bitmap) {
\r
19 BitmapDrawable b = null;
\r
22 // SDK 1.6 compatible version
\r
23 b = BitmapDrawable_SDK_1_6.getNewBitmapDrawable(resources, bitmap);
\r
24 } catch (VerifyError e) {
\r
25 // SDK 1.5 compatible version:
\r
26 use_SDK_1_6 = false;
\r
27 b = new BitmapDrawable(bitmap);
\r
30 // SDK 1.5 compatible version:
\r
31 b = new BitmapDrawable(bitmap);
\r