Code example for Bitmap

Methods: getConfiggetHeightgetWidthrecycle

0
        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
        return copyBitmap(BitmapFactory.decodeResource(getResources(), resource, options));
    } 
 
    private static Bitmap copyBitmap(Bitmap source) {
        Bitmap b = Bitmap.createBitmap(source.getWidth(), source.getHeight(), source.getConfig());
        Canvas c = new Canvas(b);
        c.drawBitmap(source, 0, 0, null);
        source.recycle();
        return b;
    } 
 
    // button hook 
    public void benchmark(View v) {
        long t = getBenchmark();
        //long javaTime = javaFilter(); 
        //mBenchmarkResult.setText("RS: " + t + " ms  Java: " + javaTime + " ms"); 
        mBenchmarkResult.setText("Result: " + t + " ms");
    } 
 
    // For benchmark test