Receiving an ACTION_SEND intent from the Gallery

后端 未结 2 1407
鱼传尺愫
鱼传尺愫 2021-02-06 05:52

I am trying to receive an image from the Android Gallery via an ACTION_SEND intent. I have set the proper intent filters and the Gallery opens my app. Now I want to know how to

2条回答
  •  天涯浪人
    2021-02-06 06:13

    Not sure about the SEND intent, but when handling returns from PICK intents to the MediaStore for a photo, it goes something like:

        Uri selectedImage = intent.getData();
        AssetFileDescriptor fd = getContentResolver()
                .openAssetFileDescriptor(selectedImage, "r");
        FileInputStream s = fd.createInputStream();
        // your image data processing code here
    

    Be careful though - you can be working with 5+ megapixel files, which can be quite large (especially if you're uncompressing them to bitmaps to process), and your memory is pretty limited.

提交回复
热议问题