How to read drawable bits as InputStream
问题 There's say some ImageView object. I want to read bits/raw data of this object as InputStream. How to do that? 回答1: First get Background image of the imageview as an object of Drawable iv.getBackground(); Then convert Drwable image into bitmap using BitmapDrawable bitDw = ((BitmapDrawable) d); Bitmap bitmap = bitDw.getBitmap(); Now use ByteArrayOutputStream to get the bitmap into the stream and get bytearray[] convert bytearray into ByteArrayInputStream you can use the following code to get