Example usage for android.graphics BitmapFactory decodeResource

List of usage examples for android.graphics BitmapFactory decodeResource

Introduction

In this page you can find the example usage for android.graphics BitmapFactory decodeResource.

Prototype

public static Bitmap decodeResource(Resources res, int id) 

Source Link

Document

Synonym for #decodeResource(Resources,int,android.graphics.BitmapFactory.Options) with null Options.

Usage

From source file:Main.java

public static Bitmap getBitmapFromResource(Context context, int resource) {
    return BitmapFactory.decodeResource(context.getResources(), resource);
}

From source file:Main.java

public static Bitmap resourceToBitmap(int res, Context context) {
    Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), res);
    return bitmap;
}

From source file:Main.java

public static Bitmap getBitmapFromRes(Context context, int resId) {
    Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resId);
    return bitmap;
}

From source file:Main.java

public static Bitmap getLocalBitmapFromResFolder(Context context, int resId) {
    return BitmapFactory.decodeResource(context.getResources(), resId);
}

From source file:Main.java

public static Bitmap getIconFromResource(int resId) {
    return BitmapFactory.decodeResource(activity.getResources(), resId);
}

From source file:Main.java

public static Bitmap getBitmapFromRes(int resId) {
    Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resId);
    return bitmap;
}

From source file:Main.java

public static Bitmap zoomImage(Resources res, int resID, int newWidth, int newHeight) {
    Bitmap map = BitmapFactory.decodeResource(res, resID);
    return Bitmap.createScaledBitmap(map, newWidth, newHeight, false);
}

From source file:Main.java

public static Bitmap drawableToBitmap(int drawable, Context context) {
    Bitmap output = null;//from  w  w w.j a  v  a 2  s . co  m
    output = BitmapFactory.decodeResource(context.getResources(), drawable);
    return output;
}

From source file:Main.java

public static Bitmap createBitmap(int resource, Context context) {
    return BitmapFactory.decodeResource(context.getResources(), resource);
}

From source file:Main.java

public static Bitmap clip(Resources resources, int drawable, int x, int y, int width, int height) {
    Bitmap resource = BitmapFactory.decodeResource(resources, drawable);
    return Bitmap.createBitmap(resource, x, y, width, height);
}