我正在尝试在我的 Android 应用程序上读取 ppt 文件。但每次运行该应用程序时,它都会在 startActivity() 处崩溃。
package com.example.myapplication;
import android.content.Intent;
import android.net.Uri;
import android.support.v4.app.ShareCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Uri pptUri = Uri.parse("/home/waheed/check.ppt");
Intent shareIntent = ShareCompat.IntentBuilder.from(this)
.setText("open ppt")
.setType("application/vnd.ms-powerpoint")
.setStream(pptUri )
.getIntent()
.setPackage("com.google.android.apps.docs");
startActivity(shareIntent);
}
}