从另一个包开始活动-问题 [英] Start activity from another package - Issue
问题描述
我从github下载了库项目并将其导入到我的应用程序项目中.问题是我想从我的主应用程序类中的该库开始活动.我尝试了许多方法,其中一种是:
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 = new Intent(); Intent intent = new Intent(); intent.setComponent(new ComponentName(
"com.tehedligmail.restorancafeler.RestaurantActivity
,
"com.cunoraz.pickImages.MainActivity")));" intent.setComponent(new ComponentName(
"com.tehedligmail.restorancafeler.RestaurantActivity
,
"com.cunoraz.pickImages.MainActivity"));" startActivity(intent); startActivity(intent); 这是我的日志: 08-29 04:40:13.937:E/AndroidRuntime(11778): android.content.ActivityNotFoundException:无法找到明确的活动类 {com.tehedligmail.restorancafeler.RestaurantActivity/com.cunoraz.pickImages.MainActivity}; 您是否在AndroidManifest.xml中声明了此活动? _---------------------------------------------- ----------------------------- _--------------------------------------------------------------------------- 我尝试过此操作,但清单无法显示包和活动类: i tried this but manifest can't show the package and activity class:
据我从日志中了解到,我应该在清单中定义要启动的类,但是我不能写这个,即使清单的自动完成也没有显示该类的名称.
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. 谢谢. As the document, I think the package name is problem. Can you try this? 并且无需在AndroidManifest.xml中声明此活动 And no need to declare this activity in AndroidManifest.xml 这篇关于从另一个包开始活动-问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! <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>
推荐答案
intent.setComponent(new ComponentName( "com.cunoraz.pickImages", "com.cunoraz.pickImages.MainActivity"));"