0 Replies - 424 Views - Last Post: 12 August 2017 - 02:22 AM

#1 Nova6112  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 90
  • Joined: 28-November 14

How can i pic image and PDF from internal / external memory in android

Posted 12 August 2017 - 02:22 AM

Hello Guys,

I searched google a lot and found few solutions but still i am getting "no apps to perform this option" . Why this error is coming and how can i select both image and PDF from my android application.

Initially i used the following code from stackoverflow

final PackageManager packageManager = mContext.getPackageManager();
						final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
						intent.setType("pdf/*");
						ComponentName testedActivity = intent.resolveActivity(mContext.getPackageManager());
						if (testedActivity != null) {
							startActivityForResult(intent,2);
						} else {
							Toast.makeText(mContext,"No file explorer available",Toast.LENGTH_LONG).show();
						}



But this always shows Toast only. if i change
intent.setType("pdf/*");
as
intent.setType("image/*");
then it works...

and then i tried one more stackoverflow

final PackageManager packageManager = mContext.getPackageManager();
						final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
						intent.setType("pdf/*");
						startActivityForResult(Intent.createChooser(intent, "Select Pdf"), 2);


for this above code always shows "Unable to find application to perform this action". How can i resolve this

Thanks in advance
Nova.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1