如何在Android上启动新应用程序

如何在Android上启动新应用程序,android,launching-application,Android,Launching Application,如何在Android上启动新应用程序?我已经做了一个新的应用程序NewHomeScreen和Hello,在NewHomeScreen上我写了这个代码 @Override public void onCreate(Bundle state) { super.onCreate(state); setContentView(R.layout.main); Intent mainIntent = new Intent(this,Hello.class); startAct

如何在Android上启动新应用程序?我已经做了一个新的应用程序NewHomeScreen和Hello,在NewHomeScreen上我写了这个代码

@Override public void onCreate(Bundle state) {
    super.onCreate(state);
    setContentView(R.layout.main);
    Intent mainIntent = new Intent(this,Hello.class);
    startActivity(mainIntent);
}
但是,它不会启动Hello应用程序。调试器说状态的值为null,但它应该是什么?我写这封信也是为了证明:

<activity android:name="Hello">
    <intent-filter>
            <action android:name="android.intent.action.HELLO" />
            <category android:name="android.intent.category.HELLO"/>
            <category android:name="android.intent.category.DEFAULT" />
    </intent-filter> 
</activity>

我想您忘了在AndroidManifest.xml文件中指定主要活动:

 <application android:icon="@drawable/icon">
    <activity android:name="NewHomeScreen" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.HELLO" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>


尝试在您的家庭活动中删除意图过滤器。如果不是主屏幕,您也不需要它。

您可以粘贴实际的logcat输出吗?