0

アプリケーションのスプラッシュ画面は、1つの画像がフェードインし、次に別の画像がフェードインし、2番目の画像が終了した後、メインアクティビティを開始するように設定されています。

2番目の画像のフェードインがほぼ完了するとすぐに、クラッシュします。

これが私のSplashScreenアクティビティです。

package com.example.gymbuddy;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class SplashScreen extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splashscreen);

    ImageView gym = (ImageView) findViewById(R.id.imageView1);
    Animation fade1 = AnimationUtils.loadAnimation(this, R.anim.gym);
    gym.startAnimation(fade1);

    ImageView buddy = (ImageView) findViewById(R.id.imageView2);
    Animation fade2 = AnimationUtils.loadAnimation(this, R.anim.buddy);
    buddy.startAnimation(fade2);
        fade2.setAnimationListener(new AnimationListener() {

            public void onAnimationStart(Animation animation) {

            }

            public void onAnimationEnd(Animation animation) {
                Intent intent = new Intent(SplashScreen.this, Main.class);
                SplashScreen.this.startActivity(intent);
                SplashScreen.this.finish();
            }

            public void onAnimationRepeat(Animation animation) {

            }
        });
}

@Override
public void onPause() {
    ImageView gym = (ImageView) findViewById(R.id.imageView1);
    gym.clearAnimation();

    ImageView buddy = (ImageView) findViewById(R.id.imageView2);
    buddy.clearAnimation();

}

}
4

1 に答える 1

0

私はそれが2つのことのうちの1つであると確信しています。

Main.classが存在しません

また

Main.classは、マニフェストでアクティビティとして宣言されていません。

マニフェストには次のようなものが必要です。

<activity android:name=".Main" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
</activity>
于 2012-09-20T21:13:13.670 に答える