Zaheer
Zaheer

Reputation: 2872

Using Intent Filters

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.

Upvotes: 0

Views: 321

Answers (4)

Anders Metnik
Anders Metnik

Reputation: 6237

Sounds like it isn't installed on your phone at all:

Rightclick project(not library), properties, Java Build Path, Order And Export. Is your library here? if, make sure that it is checked. If not, make sure that under Libraries it is added.

Upvotes: 0

Pratik
Pratik

Reputation: 30855

take a look this answer

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);

for this your another activity should be installed.

see more related post

Android, How can I use external APK in my application?

Open another application from your own (intent)

Upvotes: 0

raghav chopra
raghav chopra

Reputation: 837

<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>

Upvotes: 0

shassss
shassss

Reputation: 321

 <intent-filter>
         <action android:name="android.intent.action.MAIN" />
         <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>

Upvotes: 1

Related Questions