【发布时间】:2012-01-12 02:05:56
【问题描述】:
我一直在尝试创建一个可以在 tabhost 的帮助下打开多个活动的应用程序。其中一项支持是我想在我的应用程序中打开一个 word 文档。
我知道如何用其他应用打开一个,但我希望它可以在我的应用中打开,而不是需要按返回按钮才能返回我的应用。
我用来打开word doc的代码:
File file = new File
(Environment.getExternalStorageDirectory(),"/MLT/student.doc");
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/msword");
startActivity(intent);
我尝试将其添加到我的标签中使用
File file = new File (Environment.getExternalStorageDirectory(),"/MLT/student.doc");
intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/msword");
spec = tabHost.newTabSpec("Info").setIndicator("Info",
res.getDrawable(R.drawable.ic_tab_info)).setContent(intent);
tabHost.addTab(spec);
但我得到运行时错误,主要是
01-12 13:16:32.945: E/AndroidRuntime(10066): java.lang.SecurityException: Requesting code from com.infraware.polarisoffice (with uid 10053) to be run in process com.app.mlt (with uid 10128) "
【问题讨论】:
标签: android android-tabhost doc