简体   繁体   中英

how do i launch an activity from a seperate package via intent

I have two packages in my app com.first.main and com.second.activity2. I have tried this a few times but I keep getting class not found even though I have added these files to my manifest.

1.How do I launch the activity in the second package from the first. 2. If I have to add a second activity to the first package eg com.first.secondactivity , do I need to do anything different to launch it from the com.first.main activity?

Am really stuck on the this for last few hours so would appreciate some help

Thanks

You are probably not stating the full package name in the manifest and thus the activity is expected to be in your main package. You should state the full package name in the Activity declaration. eg:

<activity android:name="com.second.activity2.Activity"/>

And not just

<activity android:name=".Activity"/>

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