0

我的应用程序确实打开了启动画面,并且播放了背景音乐..但在那之后它应该打开一个列表活动但它崩溃了我之前尝试使用几乎所有其他名称运行相同的程序但是当我重新输入程序时它崩溃了..我已经清理并刷新了,这甚至没有任何区别

我的java文件

飞溅.java:

package com.alpha.beta;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;

public class Splash extends Activity {
MediaPlayer ourSong;

@Override
protected void onCreate(Bundle beta) {
    super.onCreate(beta);
    setContentView(R.layout.splash);
    ourSong = MediaPlayer.create(Splash.this, R.raw.splash_sound);
    ourSong.start();
    Thread timer = new Thread(){
        public void run(){
            try {
                sleep(5100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            } finally {
                Intent openStartingPoint = new Intent("com.alpha.beta.MENU");
                startActivity(openStartingPoint);
            }
        }
    };
    timer.start();
}

    @Override
    protected void onPause() {
        super.onPause();
        ourSong.release();
        finish();
}
}

清单文件:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.alpha.beta"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".Splash"
        android:label="@string/title_activity_app" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Menu"
        android:label="@string/title_activity_app" >
        <action android:name="com.alpha.beta.MENU" />

        <category android:name="android.intent.category.DEFAULT" />
    </activity>
    <activity
        android:name=".App"
        android:label="@string/title_activity_app" >
        <action android:name="com.alpha.beta.APP" />

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

           11-19 18:35:42.291: W/dalvikvm(882): threadid=7: thread exiting with uncaught exception (group=0x4001d800)
           11-19 18:35:42.321: E/AndroidRuntime(882): FATAL EXCEPTION: Thread-8
           11-19 18:35:42.321: E/AndroidRuntime(882): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.alpha.beta.Menu }
           11-19 18:35:42.321: E/AndroidRuntime(882):   at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
           11-19 18:35:42.321: E/AndroidRuntime(882):   at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
           11-19 18:35:42.321: E/AndroidRuntime(882):   at android.app.Activity.startActivityForResult(Activity.java:2817)
           11-19 18:35:42.321: E/AndroidRuntime(882):   at android.app.Activity.startActivity(Activity.java:2923)
           11-19 18:35:42.321: E/AndroidRuntime(882):   at com.alpha.beta.Splash$1.run(Splash.java:26)
           11-19 18:35:46.190: I/Process(882): Sending signal. PID: 882 SIG: 9
4

2 回答 2

1

试试这个方法

  Intent openStartingPoint = new Intent(Splash.this,Menu.class);
  startActivity(openStartingPoint);

编辑:-有时是无法获得该活动的上下文的问题。这就是为什么您可能会遇到异常ActivityNotFoundException

于 2012-11-19T13:19:00.953 回答
0

只是一个想法。在意图中,您将类名指定为MENU,但在清单中,它是Menu。尝试更改它,区分大小写可能是个问题。还要为您的Menu类定义操作。动作名称应该是VIEW

活动(启动画面和菜单)是否属于同一个包,如果是,请尝试

    Intent i = new Intent(Splash.this, Menu.class);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

startActivity(i);   
于 2012-11-19T12:59:22.407 回答