private void downloadBitmap ( final String path , final Object into , final Transformation transformation ) { //download the bitmap from bluetooth new AsyncTask < Void , Void , Bitmap > ( ) { @ Override protected Bitmap doInBackground ( Void ... params ) { Bitmap bitmap = getBitmap ( path ) ; Log . d ( TAG , "bitmap from bluetooth " + path + " " + bitmap ) ; if ( bitmap != null ) { Log . d ( TAG , "save bitmap " + path + " into cache" ) ; saveBitmap ( getKey ( path ) , bitmap ) ; if ( transformation != null ) { return transformAndSaveBitmap ( path , transformation ) ; } } return bitmap ; } @ Override protected void onPostExecute ( Bitmap bitmap ) { super . onPostExecute ( bitmap ) ; if ( into != null ) returnBitmapInto ( bitmap , path , into ) ; } } . execute ( ) ; }
Download bitmap from bluetooth asset and store it into LruCache and LruDiskCache