3

eclipse adt を使用して最初の Android アプリを開発しています。スプラッシュ画面はできたのですが、ローディングアニメーションを表示したいです。私は次のコードを持っています:

package com.sunil.splash;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;

public class Splash extends Activity {
private long ms=0;
private long splashTime=2000;
private boolean splashActive = true;
private boolean paused=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //Hides the titlebar
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.splash);

    Thread mythread = new Thread() {
        public void run() {
            try {
                while (splashActive && ms < splashTime) {
                    if(!paused)
                        ms=ms+100;
                    sleep(100);
                }
            } catch(Exception e) {}
            finally {
                Intent intent = new Intent(Splash.this, Home.class);
                startActivity(intent);
            }
        }
    };
    mythread.start();
}
}

これで私を助けてもらえますか?

4

1 に答える 1