【问题标题】:ActivityNotFoundException calling an intent on androidActivityNotFoundException 在 android 上调用意图
【发布时间】:2014-12-08 18:50:29
【问题描述】:

当我尝试执行此代码时,我得到一个 ActivityNotFoundException ,我认为这是因为我试图调用一个不在清单中但我不知道我必须添加到清单文件中的活动。

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");
    }
}

【问题讨论】:

    标签: android android-manifest activitynotfoundexception


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-24
      • 1970-01-01
      相关资源
      最近更新 更多