【发布时间】:2012-02-11 08:30:45
【问题描述】:
我对 android 很陌生,我在 .NET 中编码已经有几年了 我正在尝试创建一个应用程序,该应用程序将启动另一个应用程序,同时将一些数据传递给它。 我一直在和另一个应用程序的开发人员聊天,他说
Following is what I wrote in the AndroidManifest.xml:
<activity android:name=".EmulatorActivity"
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:mimeType="application/x-n64-rom" />
</intent-filter>
</activity>
You should set the Intent URL to something like 'file://path/rom_file', and set its mime type to 'application-x-n64-rom'.
虽然我不知道该怎么做,但我可以使用成功启动他的应用程序
Intent intent = new Intent(Intent.ActionMain);
intent.SetComponent(new ComponentName("com.androidemu.n64", "com.androidemu.n64.MainActivity"));
intent.SetFlags(ActivityFlags.NewTask);
StartActivity(intent);
但是如果我将 ActionMain 更改为 ActionView 并将 MainActivity 更改为 EmulatorActivity 它会尝试启动但崩溃 我也不知道如何传递变量:) 我尝试了很多组合,但知道我哪里出错了 我要传递的文件名位于 sd 卡调用 n64.zip 的根目录上
我试过了 intent.PutExtra(Intent.ExtraStream, Android.Net.Uri.Parse("file://sdcard/n64.zip"));
谢谢
学习
【问题讨论】:
标签: android android-intent xamarin.android