Your byte array bytes is never instantiated. So, when you call BitmapFactory.decodeByteArray, it returns null.
Since: API Level 1
Decode an immutable bitmap from the specified byte array.
The decoded bitmap, or null if the image data could not be decoded, or, if opts is non-null, if opts requested only the size be returned (in opts.outWidth and opts.outHeight)
i checked bmp file is always null added a null check and crash stops but i cant render on surfaceview.
@amITsingh is "/data/dump.txt" a valid format dump? I think it's not going to work if it's not a valid encoded byte array. Try checking this and see if it helps
nadir as i mentioned its a raw rgb 888 format dump.. is this a valid format to be decoded into bitmap or only jpeg and png valid formats ?
@amITsingh the valid formats are defined by BitmapFactoryOptions.inPreferredConfig. Here are the possible values (you should probably use ARGB_8888, add the alpha layer to your bytearray, then it should work correctly).
yes i added the pixel format to make it work , correct me if i am wrong i should use ARGBX_888 if i want to ignore the alpha channels