私はしばらくの間働いている私のスプラッシュ画面でいくつかのエラーがあり、把握することはできません。私のスプラッシュ画面をスレッドよりも時間を取る良い方法はありますか?現在のスレッドで何が問題になっていますか?私のメディアプレーヤーオブジェクトの問題を見ることができますか?スプラッシュスクリーンスレッドのエラーをスローします。解決する方法? (コードとエラーが含まれています)
私のスプラッシュクラスの勇気を投稿しました。うまくいけば、私はこれらの問題についていくつかの方向性を得ることができます。これは、私がアプリを実行するときに動作しますが、私はエラーが発生したくないだけです。
-------------------------コード------------------- -----------
@Override
public void onCreate(Bundle savedInstanceState) {
......onCreate, hide window, and setting content view.......
// Play Sound for startup
mpSplash = MediaPlayer.create(this, R.raw.splashscream);
mpSplash.start();
final Splash splash = this;
logoTimer = new Thread(){
public void run(){
try {
synchronized(this){
// Wait given period of time or exit on touch
wait(4500);
}
}
catch(InterruptedException ex){
ex.printStackTrace();
}
finish();
mpSplash.stop();
mpSplash.reset();
//mpSplash.release();
//mpSplash.release();
// Run next activity
Intent intent = new Intent();
intent.setClass(splash, Game.class);
startActivity(intent);
stop();
}
};
logoTimer.start();
}
// Splash screen touch events
@Override
public boolean onTouchEvent (MotionEvent evt)
{
if(evt.getAction() == MotionEvent.ACTION_DOWN)
{
// Stop the introduction sounds
mpSplash.stop();
mpSplash.reset();
//mpSplash.release();
//mpSplash.release();
synchronized(logoTimer){
logoTimer.notifyAll();
}
}
return true;
}
------------------------------エラー-----------------------------
09-11 21:50:04.644: ERROR/MediaPlayer(460): stop called in state 1
09-11 21:50:04.644: ERROR/MediaPlayer(460): error (-38, 0)
09-11 21:50:04.654: ERROR/global(460): Deprecated Thread methods are not supported.
09-11 21:50:04.654: ERROR/global(460): java.lang.UnsupportedOperationException
09-11 21:50:04.654: ERROR/global(460): at java.lang.VMThread.stop(VMThread.java:85)
09-11 21:50:04.654: ERROR/global(460): at java.lang.Thread.stop(Thread.java:1379)
09-11 21:50:04.654: ERROR/global(460): at java.lang.Thread.stop(Thread.java:1344)
09-11 21:50:04.654: ERROR/global(460): at com.ss.lastzombie.Splash$1.run(Splash.java:61)
ありがとう!!
エラーはコンテキストにありません。行番号はエラーが発生している場所を示します。あなたのコードでSplash.java:61を指摘する必要があります。 –
@Charles Line 61はstartActivity(intent)です。 – KRB