【问题标题】:Start activity from another package - Issue从另一个包开始活动 - 问题
【发布时间】:2017-08-28 17:26:10
【问题描述】:

我从 github 下载了库项目并将其导入到我的应用程序项目中。问题是我想在我的主应用程序类中从这个库开始活动。我尝试了很多方法,其中一种是:


Intent 意图 = new Intent();

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

startActivity(intent);


这是我的日志:

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

android.content.ActivityNotFoundException:找不到明确的活动类 {com.tehedligmail.restorancafeler.RestaurantActivity/com.cunoraz.pickImages.MainActivity};

您是否在 AndroidManifest.xml 中声明了此活动?

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

我试过了,但清单无法显示包和活动类:

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

据我所知,我应该在我的清单中定义我想要启动的类,但我不能写这个,即使清单的自动完成也没有显示这个类的名称。

提前致谢。

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

【问题讨论】:

  • 对不起我的英语,我知道这很糟糕。该问题仅基于从活动到另一个活动的意图操作,请不要对问题投反对票...
  • 不要担心您的英语,但请澄清您尝试过的内容以及无效的内容,以便人们可以帮助您达到您想要的结果!
  • 我编辑了我的问题:)
  • 我仍然不知道(我刚刚在一个审核队列中看到了您的帖子),但现在似乎更有可能有人能够提供帮助!
  • 我是个倒霉的家伙 :D

标签: java android android-intent manifest


【解决方案1】:

作为document,我认为包名有问题。你可以试试这个吗?

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

并且无需在 AndroidManifest.xml 中声明此活动

【讨论】:

    猜你喜欢
    • 2013-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多