Code example for BitmapFactory.Options

Methods: decodeFile

    // Decode image in background. 
    protected Bitmap doInBackground(String... params) {
        data = params[0];
        Options opts = new BitmapFactory.Options();
        opts.inSampleSize = 2;   // for 1/2 the image to be loaded
        Bitmap original = BitmapFactory.decodeFile(data, opts);
        Integer[] newSize = BitmapHelper.GetThumbnailSize(original, 100, 100);
        Bitmap thumb = Bitmap.createScaledBitmap (original,newSize[0], newSize[1], false);
       return thumb;
    // Once complete, see if ImageView is still around and set bitmap. 
    protected void onPostExecute(Bitmap bitmap) {
Experience pair programming with AI  Get Codota for Java