0

我设计了Main课。从 main 我调用另一个名为Menuextends的类Activity,从Menu class我调用另一个活动类。但它不起作用。清单文件中需要进行哪些更改?

这里是logcat

09-09 23:53:42.741: D/gralloc_goldfish(2105): Emulator without GPU emulation detected.
09-09 23:53:47.982: D/AndroidRuntime(2105): Shutting down VM
09-09 23:53:47.982: W/dalvikvm(2105): threadid=1: thread exiting with uncaught exception (group=0xb4e02288)
09-09 23:53:48.011: E/AndroidRuntime(2105): FATAL EXCEPTION: main
09-09 23:53:48.011: E/AndroidRuntime(2105): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.parse.starter/com.parse.starter.Placementmania}; have you declared this activity in your AndroidManifest.xml?
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1541)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.app.Activity.startActivityForResult(Activity.java:3351)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.app.Activity.startActivityForResult(Activity.java:3312)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.app.Activity.startActivity(Activity.java:3522)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.app.Activity.startActivity(Activity.java:3490)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at com.parse.starter.Mainmenu$1.onClick(Mainmenu.java:27)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.view.View.performClick(View.java:4084)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.view.View$PerformClick.run(View.java:16966)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.os.Handler.handleCallback(Handler.java:615)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.os.Looper.loop(Looper.java:137)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at android.app.ActivityThread.main(ActivityThread.java:4745)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at java.lang.reflect.Method.invokeNative(Native Method)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at java.lang.reflect.Method.invoke(Method.java:511)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-09 23:53:48.011: E/AndroidRuntime(2105):     at dalvik.system.NativeStart.main(Native Method)
09-09 23:53:50.212: I/Process(2105): Sending signal. PID: 2105 SIG: 9
4

3 回答 3

1

在您的清单中,您将看到此代码

   <activity
        android:name="com.example.yourappname.MainScreen"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

基本上复制并粘贴它并修改粘贴的每个类的名称和类别,如下所示:

   <activity
        android:name="com.example.audeoapp.OtherClass" >
        <intent-filter>
            <action android:name="android.intent.action.OTHERCLASS" />

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

   <activity
        android:name="com.example.audeoapp.AnotherClass" >
        <intent-filter>
            <action android:name="android.intent.action.ANOTHERCLASS" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
于 2013-09-09T19:09:02.547 回答
0

intent.action.main 和 intent.category.launcher 告诉你这个活动是你的主要和启动活动,当你启动你的应用程序时应该打开它。对于其他活动,只需将你的活动名称和标签放在新的活动标签中。

于 2013-09-09T19:26:16.870 回答
0

将此添加到您的清单中

        <activity
        android:name="com.parse.starter.Placementmania"
        android:label="@string/app_name"
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
于 2013-09-09T19:06:20.647 回答