Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.app.Application;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Main {
    private static Application sApp;

    /**
     * decode bitmap from resource id.
     */
    public static Bitmap res2bitmap(int resId) {
        return BitmapFactory.decodeResource(sApp.getResources(), resId, null);
    }

    /**
     * decode bitmap from resource id
     */
    public static Bitmap res2bitmap(int resId, BitmapFactory.Options opt) {
        return BitmapFactory.decodeResource(sApp.getResources(), resId, opt);
    }
}