0
  File file = new File(filePath, fileType);
       try (FileOutputStream fOut = new FileOutputStream(file)) {
           fOut.write(Base64.decode(byteArrayvalue, 0));
           fOut.flush();
           fOut.close();
           Common.openFile(fragmentName, file);

       }

 Uri uri = Uri.fromFile(file);
 intent.setDataAndType(uri, "application/pdf");
 fragment.getActivity().startActivity(intent);

I have a PDF file in my local storage in my mobile. I am trying to open it programatically in my app , but on launch it shows all the apps which can read pdf. But i want to show user only Adobe pdf reader. i don't want other apps to be displayed. I want to choose which app should open the file.Please help on this.

Girijesh
  • 3
  • 5
  • Look at this thread: https://stackoverflow.com/a/10035789/421195. The technique should be similar for PDFs..Use `myIntent.setPackage("com.adobe.reader");` – paulsm4 Sep 16 '20 at 06:14
  • You can start an explicit intent to open this app. You have to find out the package name of this application first and then use that package name to create the intent which opens this app. Thing is this app should allow such intents otherwise it might now work – Ezio Sep 16 '20 at 06:15
  • @Ezio, how would that app know that such an intent is used? What would be the difference it sees? – blackapps Sep 16 '20 at 06:17
  • @paulsm4 its working fine for me for single app , can i set multiple packages to intent – Girijesh Sep 16 '20 at 09:28

0 Answers0