Android 如何从其他应用程序启动我的应用程序?
如何从其他应用程序启动我的应用程序?它们不会打包在一起 -更新 第二个应用程序的清单:Android 如何从其他应用程序启动我的应用程序?,android,Android,如何从其他应用程序启动我的应用程序?它们不会打包在一起 -更新 第二个应用程序的清单: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloandroid" android:versionCode="1" android:vers
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloandroid"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloAndroid"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".HelloAndroid">
<intent-filter>
<action android:name="com.example.helloandroid.HelloAndroid" />
</intent-filter>
</activity>
</application>
</manifest>
它抛出:
07-16 15:11:01.455: ERROR/Desktop(610): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.helloandroid.HelloAndroid }
相关:
在第一个应用程序中,您必须修改AndroidManifest.xml。具体而言,您将向要从某处启动的活动的意图过滤器中添加一个自定义操作: 关于你的评论:
看起来如果我更改默认名称android.intent.action.MAIN,我将无法在虚拟设备中从Eclipse运行应用程序 记住你可以有你想要的任何行动。。。例如:
<activity android:name="FirstApp">
<intent-filter>
<action android:name="com.example.foo.bar.YOUR_ACTION" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
在第一个应用程序中,您必须修改AndroidManifest.xml。具体而言,您将向要从某处启动的活动的意图过滤器中添加一个自定义操作: 关于你的评论:
看起来如果我更改默认名称android.intent.action.MAIN,我将无法在虚拟设备中从Eclipse运行应用程序 记住你可以有你想要的任何行动。。。例如:
<activity android:name="FirstApp">
<intent-filter>
<action android:name="com.example.foo.bar.YOUR_ACTION" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
这个问题似乎与我之前回答的问题相似 如果您只想像从启动器启动一样启动:
Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(new ComponentName( "PACKAGE NAME", "CLASS" ));
startActivity(intent);
这个问题似乎与我之前回答的问题相似 如果您只想像从启动器启动一样启动:
Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(new ComponentName( "PACKAGE NAME", "CLASS" ));
startActivity(intent);
看起来如果我更改默认名称android.intent.action.MAIN,我将无法在虚拟设备中从Eclipse运行应用程序。我能在手机上作为一个独立的应用程序运行吗?按你说的做了,正在抛出:android.content.ActivityNotFoundException:找不到处理Intent{act=com.example.helloandroid.helloandroid}的活动。你知道怎么回事吗?现在我添加了一个新的活动,而不是更改现有的活动。我已经编辑了我的答案。另外,我想看看你第一个应用的AndroidManifest,以及你第二个活动的源代码。很好!我把我的行为放在了错误的地方,你可以从我对这个问题的更新中看到。。谢谢此外,将被调用的应用程序需要在清单中的intent过滤器元素内:如果我更改了默认名称android.intent.action.MAIN,我将无法从虚拟设备中的Eclipse运行该应用程序。我能在手机上作为一个独立的应用程序运行吗?按你说的做了,正在抛出:android.content.ActivityNotFoundException:找不到处理Intent{act=com.example.helloandroid.helloandroid}的活动。你知道怎么回事吗?现在我添加了一个新的活动,而不是更改现有的活动。我已经编辑了我的答案。另外,我想看看你第一个应用的AndroidManifest,以及你第二个活动的源代码。很好!我把我的行为放在了错误的地方,你可以从我对这个问题的更新中看到。。谢谢此外,将被调用的应用程序需要在清单中的intent过滤器元素中包含:与前面的答案相同,在最后一个答案中有一个加号问题:android.content.ActivityNotFoundException:找不到显式活动类{com.example.helloandroid/helloandroid};您是否在AndroidManifest.xml中声明了此活动?与前面的答案相同,最后还有一个加号问题:android.content.ActivityNotFoundException:找不到显式活动类{com.example.helloandroid/helloandroid};您是否在AndroidManifest.xml中声明了此活动?
Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(new ComponentName( "PACKAGE NAME", "CLASS" ));
startActivity(intent);