Problem - Tangible delay in getting and clipping a Bitmap from a drawable .

 Bitmap bt = BitmapFactory.decodeResource(context.getResources(), R.drawable.bg); bt = Bitmap.createScaledBitmap(bt, width, height, true); 

How can I optimize / speed up getting a clipped Bitmap ?

  • one
    Move to the stream, so that the interface responds smoothly without delay - VAndrJ
  • @VAandrJ Thanks for the advice, but this method does not suit me. - Igor
  • @Igor, only this way exists. If it does not suit you, then your application is built incorrectly, and you need not to look for another way (read a crutch ), but to remake the application in such a way that this method is suitable. - Vladyslav Matviienko

1 answer 1

Try rewriting this:

 Bitmap oldBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.bg); scaledBitmap = Bitmap.createScaledBitmap(oldBitmap, width, height, true); oldBitmap.recycle(); 
  • Rewrote did not help. BitmapFactory.decodeResource - 4 times longer than Bitmap.createScaledBitmap. - Igor
  • and high resolution picture? - Android Android
  • Yes. And size size 1080x1920, - Igor