-2

When I try to execute this code I get an ActivityNotFoundException ,I think it's because I'm trying to call an activity which is not in the manifest but i don't know what I have to add to the manifest file.

public boolean onOptionsItemSelected(MenuItem item) {

    int id = item.getItemId();
    if (id == R.id.action_settings) {
       Uri path=Uri.parse("android.resource://com.android.was4fi/"+R.drawable.miarchivo);
       Intent intent=new Intent(Intent.ACTION_VIEW);
       intent.setDataAndType(path, "application/pdf");
    }
}
4

1 回答 1

0

不,问题不在您的清单文件中。您正在尝试使用隐式意图,而 Android 系统找不到可以处理此意图的活动。在http://developer.android.com/guide/components/intents-filters.html#ExampleSend上阅读更多内容。此代码也应包含在 try/catch 块中。

于 2014-12-08T19:20:37.583 回答