Android: bitmapfactory.decodestream returns null

前端 未结 5 1940
鱼传尺愫
鱼传尺愫 2020-12-19 07:33

I have tried to get the bitmap image from the path of the image. But BitmapFactory.decodeStream returns null value.

Code:

U         


        
5条回答
  •  无人及你
    2020-12-19 08:22

    BufferedInputStream is necessary before decodestream....

    Try this it works perfect for me use;

    BufferedInputStream buf = new BufferedInputStream(inputsteam, 1024);

    Pass buf to decode stream it will work perfectly.

    Bitmap theImage = BitmapFactory.decodeStream(buf);

    Finally set your bitmap.

提交回复
热议问题