Opening PPT-Files
-
29-06-2021 - |
Question
I want to open a PPT-file with my app. How can I check if there is an app that can display these files installed on the device and how can I launch it?
La solution
Try something like this. Havent tried but might work
final Uri uri = Uri.fromFile(file);
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "application/vnd.ms-powerpoint");
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
if(list.size() > 0)
startActivity(context, intent);
Autres conseils
File file = new File("path_to_the_file.ppt");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),"application/vnd.ms-powerpoint");
startActivity(intent);
try with this
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow