Xamarin Android.Content.ActivityNotFoundException:Mupdf

时间:2016-08-17 10:07:51

标签: android xamarin mupdf

我在my.cs中收到此错误:

  

Android.Content.ActivityNotFoundException:无法找到显式活动类    {DesignLibrary_Tutorial.DesignLibrary_Tutorial / com.artifex.mupdfdemo.MuPDFActivity};    你有没有在AndroidManifest.xml中声明这个活动?

这是my.cs代码:

File file = (File)fileFromAsset(this, "test.pdf");
var uri = Android.Net.Uri.Parse(file.AbsolutePath);
var intent0 = new Intent(this, typeof(MuPDFActivity));
intent0.SetFlags(ActivityFlags.NoHistory);
intent0.SetAction(Intent.ActionView);
intent0.SetData(uri);
StartActivity(intent0);

这是我的android.manifest标签:

<?xml version="1.0" encoding="utf-8"?>

              

<activity android:name="com.artifex.mupdfdemo.MuPDFActivity">
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="application/vnd.ms-xpsdocument" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="application/pdf" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="application/x-cbz" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="file" />
    <data android:mimeType="*/*" />
    <data android:pathPattern=".*\\.xps" />
    <data android:host="*" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="file" />
    <data android:mimeType="*/*" />
    <data android:pathPattern=".*\\.pdf" />
    <data android:host="*" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="file" />
    <data android:mimeType="*/*" />
    <data android:pathPattern=".*\\.cbz" />
    <data android:host="*" />
  </intent-filter>
</activity>

0 个答案:

没有答案