Android examples for Graphics:Bitmap Size
Get Bitmap's Width
//package com.java2s; import android.content.res.Resources; import android.graphics.BitmapFactory; public class Main { /** Get Bitmap's Width **/ public static int getBitmapOfWidth(Resources res, int id) { try {/*from w ww. ja va2 s. c o m*/ BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(res, id, options); return options.outWidth; } catch (Exception e) { return 0; } } }