I have an issue with my android app


#1

please can any one help me with my project … i make my first project it’s about Instagram downloader and i launched it to my friends to testing the project then i have an issue with Nougat 24 Preformatted textit’s called Exception android.os.FileUriExposedException: file:///storage/emulated/0/Save4Insta/VIDEO_28271403_205337093353385_3058135105525514240_n.mp4 exposed beyond app through Intent.getData()

here is the issue in Code

Uri uri = Uri.parse(“file://” + filex.toString());
Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW);
i.setDataAndType(uri, “image/*”);
HERE >>>>>>> inContext.startActivity(i);

                } else {
                    inTmp = Uri.parse(img);
                    Image_DownloadId = DownloadData(inTmp, "IMAGE_" + inFileName);
                }
            }else {
                inFileName = vid.substring(vid.lastIndexOf('/') + 1);

                File sdcard = Environment.getExternalStorageDirectory();
                File filex = new File(sdcard, inDir + "/" + "VIDEO_" + inFileName);
                if(filex.exists()) {
                    if (inDialog.isShowing())
                        inDialog.dismiss();

                    Uri uri = Uri.parse("file://" + filex.toString());
                    Intent i = new Intent();
                    i.setAction(android.content.Intent.ACTION_VIEW);
                    i.setDataAndType(uri, "video/*");
      HERE >>>>>>>>             inContext.startActivity(i);
                } else {
                    inTmp = Uri.parse(vid);
                    Video_DownloadId = DownloadData(inTmp, "VIDEO_" + inFileName);
                }
            }
        }
    });`Preformatted text`

#2

I would suggest going to a forum frequented by people with expertise in Android development. When you post on random forums that happen to be coding-related, you have no way of knowing that someone with the required knowledge will ever see your question.


#3

You also have “an issue with preformatted text“ on this forum :wink: