4

I am developing a custom camera application which captures a picture and stores it in the gallery. When I share that image using Intent.ACTION_SEND, it works absolutely fine on all devices except for devices having API 26, i.e. OREO.

My code to share the image is:

Intent shareIntent = new Intent();
            shareIntent.setAction(Intent.ACTION_SEND);
            shareIntent.setType("image/jpeg");
            Uri uriShare = Uri.fromFile(outFile);
            //outfile is the path of the image stored in the gallery
            shareIntent.putExtra(Intent.EXTRA_STREAM, uriShare);
            startActivity(Intent.createChooser(shareIntent, ""));

Can anyone help me resolve this issue?

4

3 に答える 3

3

ファイル プロバイダーを使用してIMAGE URIを取得し、インテントにフラグを追加します...次の手順を慎重に実行してください.. )この更新は nougat 以来行われています..

于 2018-02-14T07:12:10.237 に答える