简体   繁体   中英

Start activity from another package - Issue

I downloaded library project from github and imported it into my app project.The problem is that i want to start activity from this library in my main app class.I tried many ways and one of them was:


Intent intent = new Intent();

intent.setComponent(new ComponentName( "com.tehedligmail.restorancafeler.RestaurantActivity , "com.cunoraz.pickImages.MainActivity"));"

startActivity(intent);


This is my log:

08-29 04:40:13.937: E/AndroidRuntime(11778):

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.tehedligmail.restorancafeler.RestaurantActivity/com.cunoraz.pickImages.MainActivity};

have you declared this activity in your AndroidManifest.xml?

_---------------------------------------------------------------------------

i tried this but manifest can't show the package and activity class:

  <activity android:name="com.luminous.pick.MainActivity"> <intent-filter> <action android:name="com.luminous.pick.MainActivity" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> 

As i understand from log i should define the class that i want to launch in my manifest,but i couldn't write this,even autocomplete of manifest didn't show this class's name.

Thanks in advance.

For more information This is image shows library and main project of my app

As the document , I think the package name is problem. Can you try this?

intent.setComponent(new ComponentName( "com.cunoraz.pickImages", "com.cunoraz.pickImages.MainActivity"));"

And no need to declare this activity in AndroidManifest.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM