0

私は Animation Drawable を使用して、単純な Android ゲームの一種のストーリーを作成しています。「開始」ボタンを押すと、スキップボタン付きのストーリーが出現。ストーリーラインを表す写真のリストに新しい写真を追加するまで、すべてが正常に機能し、アプリ全体が機能しなくなり、「残念ながらアプリが停止しました」と表示されます

ここに私のXMLファイルがあります:

    <?xml version="1.0" encoding="utf-8"?>

<animation-list xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/selected" android:oneshot="true">
    <item android:drawable="@drawable/homeone" android:duration="50" />
    <item android:drawable="@drawable/hometwo" android:duration="50" />
    <item android:drawable="@drawable/homethree" android:duration="50" />
    <item android:drawable="@drawable/homefour" android:duration="50" />
    <item android:drawable="@drawable/homefive" android:duration="50" />
    <item android:drawable="@drawable/homesix" android:duration="50" />
    <item android:drawable="@drawable/homeseven" android:duration="50" />
    <item android:drawable="@drawable/tableone" android:duration="50" />
    <item android:drawable="@drawable/tabletwo" android:duration="50" />
    <item android:drawable="@drawable/tablethree" android:duration="50" />
    <item android:drawable="@drawable/tablefour" android:duration="50" />
    <item android:drawable="@drawable/tablefive" android:duration="50" />
    <item android:drawable="@drawable/tablesix" android:duration="50" />
    //After adding the last line "tablesix", the app stop working

</animation-list>

そして、ここに私のJavaファイルがあります:

package xx.tellme;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;

public class StoryLine extends Activity{

    ImageView story;
    ImageButton skip;
    AnimationDrawable anime;


    protected void onCreate(Bundle savedInstanceState) {

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.stortlinelayout);


            story = (ImageView) findViewById(R.id.imageView1);
            skip = (ImageButton) findViewById(R.id.skipbut);

            anime = new AnimationDrawable();
            story.setBackgroundResource(R.drawable.dlist);

            anime =(AnimationDrawable) story.getBackground();

            anime.start();

            skip.setOnClickListener(new View.OnClickListener() {

            @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    startActivity(new Intent("xx.tellme.KAR"));
                }
            });


    }

}

何をすればよいでしょうか ?または、この離れたアニメーション ドローアブルを作成する別の方法はありますか?

4

0 に答える 0