List of usage examples for android.content Context getDrawable
@Nullable public final Drawable getDrawable(@DrawableRes int id)
From source file:Main.java
@TargetApi(LOLLIPOP) public static Drawable getDrawable(Context context, int id) { if (isCompatible(LOLLIPOP)) { return context.getDrawable(id); } else {/*from w ww .ja v a2s . c o m*/ return context.getResources().getDrawable(id); } }
From source file:Main.java
@SuppressWarnings("deprecation") public static Drawable getDrawable(Context c, int d) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return c.getDrawable(d); } else {/*ww w.jav a 2 s . c om*/ return c.getResources().getDrawable(d); } }
From source file:Main.java
public static Bitmap vectorToBitmap(Context context, @DrawableRes int vectorDrawableId) { return vectorToBitmap(context, context.getDrawable(vectorDrawableId)); }
From source file:Main.java
/** * Convert resId to drawable/*from ww w. j a v a 2s . c o m*/ * * @param context * @param resId * @return */ public static Drawable resToDrawable(Context context, int resId) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return context.getDrawable(resId); } return context.getResources().getDrawable(resId); }
From source file:Main.java
public static Drawable getDrawable(Context context, int resId) { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return context.getDrawable(resId); }//from www . java 2 s . c om return context.getResources().getDrawable(resId); }
From source file:Main.java
public static Drawable getDrawable(Context context, int drawableId) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return context.getDrawable(drawableId); } else {//from w w w . j a va 2 s .c om return context.getResources().getDrawable(drawableId); } }
From source file:Main.java
public static Drawable getDrawale(Context context, int id) { Drawable drawable;// w w w .j av a 2 s . com if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) drawable = context.getDrawable(id); else drawable = context.getResources().getDrawable(id); return drawable; }
From source file:Main.java
@Nullable @SuppressWarnings("deprecation") static Drawable getDrawable(@NonNull Context context, @DrawableRes int drawableId) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return context.getDrawable(drawableId); //noinspection deprecation return context.getResources().getDrawable(drawableId); }
From source file:Main.java
public static Drawable getDrawable(Context context, @DrawableRes int drawableRes) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return context.getDrawable(drawableRes); } else {/*from w w w . j a v a 2s. c o m*/ //noinspection deprecation return context.getResources().getDrawable(drawableRes); } }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static Drawable getDrawable(Context context, int drawableRes) { if (Build.VERSION.SDK_INT < 21) { //noinspection deprecation return context.getResources().getDrawable(drawableRes); } else {//w w w .ja va 2s .c o m return context.getDrawable(drawableRes); } }