2017-05-25 56 views
0

我试图在我从主应用程序导入的模块上启动活动。 什么都没有发生。没有崩溃,也没有发射。这是我在我的主要的应用程序代码:从主应用程序启动活动模块Android

Intent moduleActivity = new Intent("com.service.ModuleActivity"); 
startActivity(moduleActivity); 

这里是模块清单:

<application 
    android:allowBackup="true" 
    android:supportsRtl="true" 
    android:largeHeap="true" 
    android:persistent="true" > 

    <activity android:name="com.service.ModuleActivity" 
     android:screenOrientation="landscape" 
     android:launchMode="singleTask"> 
     <intent-filter> 
      <action android:name="com.service.ModuleActivity" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 
</application> 

我没有崩溃和调试Intent moduleActivitynull 我错过了什么?

+2

开发嗨,试图取代线意图moduleActivity =新意图( “com.service.ModuleActivity”); with Intent moduleActivity = new Intent(context,ModuleActivity.class); –

+0

一个参数Intent构造函数用于指定一个操作,如VIEW。你不用它来指定一个类名。 –

+0

@RishabhBhatia新Intent(context,ModuleActivity.class)也没有发生; – DevAndroid

回答

0

最后我解决吧..

Intent moduleActivity = new Intent("com.service.ModuleActivity"); 
moduleActivity .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //by adding this line 
startActivity(moduleActivity); 

感谢所有

+0

这个错误会在您的LogCat https://developer.android.com/studio/command-line/logcat.html中显示 – Blundell

相关问题