Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在Mono for Android上启动外部活动错误_C#_Android_Mono - Fatal编程技术网

C# 在Mono for Android上启动外部活动错误

C# 在Mono for Android上启动外部活动错误,c#,android,mono,C#,Android,Mono,我今天遇到了很多问题,试图添加一个调用我编写的另一个应用程序的意图,我想从另一个应用程序中获得它。关于这个话题有很多信息,但似乎没有任何效果,我发现了这个问题,并想分享我的经验,以防其他人也有同样的问题 我的舱单上有这个项目 <activity android:name="CraftTabs"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <cate

我今天遇到了很多问题,试图添加一个调用我编写的另一个应用程序的意图,我想从另一个应用程序中获得它。关于这个话题有很多信息,但似乎没有任何效果,我发现了这个问题,并想分享我的经验,以防其他人也有同样的问题

我的舱单上有这个项目

<activity android:name="CraftTabs">
  <intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>

这导致“未找到活动”异常

问题的根源最终是“CraftTabs”活动的名称空间。它列在mycompany中,因此生成了清单

因此,解决方案就是删除com。从SetClassName方法,即

 intent.SetClassName("com.mycompany.calculator", "mycompany.CraftTabs");
所以,希望这能帮助你们中的任何一位单声道编码员节省一些头发

如果所有其他操作都失败,只需在下面查找Mono生成的清单
obj/debug/android/AndroidManifest.xml

在清单文件中提供完全限定名。

<activity android:name="com.mycompany.calculator.CraftTabs">
  <intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>

在我的例子中,这不起作用,因为名称空间没有列为“namespace com.mycompany.calculator.CraftTabs{}”,而是列为“namespace mycompany.calculator.CraftTabs{}”,因此在代码中,我必须按照下面列出的方式编写它,'intent.SetClassName(“com.mycompany.calculator”,“mycompany.CraftTabs”);'
<activity android:name="com.mycompany.calculator.CraftTabs">
  <intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>