0

I'm having a really odd problem that seems very unrelated. I'm trying to use intent filters to open an activity (as recc from other questions on SO) in my main application from an activity in a library I created. In the library activity I create/call the intent like so:

Intent i = new Intent("com.application.mainapplication.tagDetailActivity");
// sending data to new activity
i.putExtra("sub_category", subCats[(int)id]); //Serializable data
i.putExtra("Category", category.name);
startActivity(i);

If I comment the two i.putExtra's I get the following error:

Could not find Library.apk!

In my manifest for the main application I have:

<activity android:name=".tagDetailActivity">
    <intent-filter >
        <action android:name="com.tagsforlikes.tagsforlikes.tagDetailActivity" />
    </intent-filter>
</activity>

I'm not really sure why putExtra's are causing this error. Am I creating the intent correctly? It doesn't look much different than starting a normal intent (read: not intentfilter) and I'm worried I'm creating it wrong.

UPDATE

I think there is some confusion. The activity I am trying to call is not the main activity of the main application. So for the application I have a Free/Pro version that both reference a library. In the free/pro version, the main activity creates an activity in the library which in turn must call an activity in the free/pro version again.

4

4 回答 4

1
 <intent-filter>
         <action android:name="android.intent.action.MAIN" />
         <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>
于 2012-08-21T07:15:57.147 回答
0
<activity android:name=".--your class name--" android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
于 2012-08-21T07:29:04.103 回答
0

听起来它根本没有安装在您的手机上:

右键单击项目(不是库)、属性、Java 构建路径、顺序和导出。你的图书馆在吗?如果,请确保已检查。如果没有,请确保在库下添加了它。

于 2012-08-21T10:08:36.647 回答
0

看看这个答案

Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(ComponentName.unflattenFromString("com.google.android.maps.mytracks/com.google.android.apps.mytracks.MyTracks"));
intent.addCategory("android.intent.category.LAUNCHER");
startActivity(intent);

为此,您应该安装另一个活动。

查看更多相关帖子

Android,如何在我的应用程序中使用外部 APK?

从您自己的(意图)打开另一个应用程序

于 2012-08-21T07:47:30.567 回答