Opening PPT-Files
-
29-06-2021 - |
سؤال
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?
المحلول
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);
نصائح أخرى
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
لا تنتمي إلى StackOverflow