Retrieve bitmap from uri

前端 未结 7 1635
终归单人心
终归单人心 2021-01-01 17:06

I have included \'share via myApp\' option. I inserted following code in the receiving activity class.

    // Get the intent that started this activity
    I         


        
7条回答
  •  隐瞒了意图╮
    2021-01-01 17:48

    Retrive bitmap from uri.....
    
    public static Bitmap decodeUriToBitmap(Context mContext, Uri sendUri) {
            Bitmap getBitmap = null;
            try {
                InputStream image_stream;
                try {
                    image_stream = mContext.getContentResolver().openInputStream(sendUri);
                    getBitmap = BitmapFactory.decodeStream(image_stream);
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return getBitmap;
        }
    

提交回复
热议问题