OK、Androidアプリで理解できない問題が発生しています。MediaPlayer mpWeight = MediaPlayer.create(this, R.raw.mppig)
以下のコードでは、 ;でエラーが発生しています。
createの上にカーソルを置くと、次のようになります。
create(Context, int)
タイプのメソッドMediaPlayer
は引数には適用できません(new View.OnFocusChangeListener(){}, int
)
それはどういう意味ですか、そしてもっと重要なことに、どうすればそれを解決できますか?
ルーチン全体は次のとおりです。
TextView tv=(TextView)findViewById(R.id.weight);
tv.setOnFocusChangeListener(new OnFocusChangeListener(){
@Override
public void onFocusChange(View v,boolean hasFocus){
/* When focus is lost check that the text field
* has valid values.
*/
if (!hasFocus) {
float tempweight = Float.parseFloat(et_weight.getText().toString());
if(tempweight > 200){
MediaPlayer mpWeight = MediaPlayer.create(this, R.raw.mppig);
mpWeight.start();
}
}
}
});