0

私はスプラッシュ.Javaにサウンドを追加し始めていますが、エラーが発生しています.すべてがうまくいっていると思います.

取得するエラーは次のとおりです。

Multiple markers at this line
- Syntax error on token ".", class expected after this token
- The method create(Context, Uri) in the type MediaPlayer is not applicable for the arguments     (Splash, 

ライン上

        MediaPlayer start = MediaPlayer.create(Splash.this, R.raw.splashsound); 

私のプログラムは:

package com.sc.uploader;

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

public class Splash extends Activity {

@Override
protected void onCreate(Bundle IloveU) {
    // TODO Auto-generated method stub
    super.onCreate(IloveU);
    setContentView(R.layout.splash);
    MediaPlayer start = MediaPlayer.create(Splash.this, R.raw.splashsound); 
    start.start();
    Thread timer = new Thread(){

        public void run(){
            try{
                sleep(5000);

            } catch (InterruptedException e){
                e.printStackTrace();
            }finally {
                Intent openStarting = new       Intent("com.sc.uploader.MAINACTIVITY");
                startActivity(openStarting);
            }

        }

    };
    timer.start();

}



}

エラーの内容とその修正方法がわかれば、本当に助かります。

4

1 に答える 1

0

問題は、間違ったものが使用されているため、ここで使用しようとしidているアプリが混乱していることです。constructor

MediaPlayer start = MediaPlayer.create(Splash.this, R.raw.splashsound); 

適切ではありませんでしたid。代わりに、そうする必要がありました

MediaPlayer start = MediaPlayer.create(Splash.this, R.raw.e); 

メディアプレーヤー

の構文は ( を使用してContext, reaourceid) 正しいように見えたconstructorが、アプリは別の を使用しようとしていたため、が間違ってconstructorいると信じるようになりました。resourceid

于 2013-10-18T15:51:40.010 に答える