@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);メソッドTimeUnitを解決できません。
b1 = (Button) findViewById(R.id.button);
b2 = (Button) findViewById(R.id.button2);
b3 = (Button) findViewById(R.id.button3);
b4 = (Button) findViewById(R.id.button4);
iv = (ImageView) findViewById(R.id.imageView);
tx1 = (TextView) findViewById(R.id.textView2);
tx2 = (TextView) findViewById(R.id.textView3);
tx3 = (TextView) findViewById(R.id.textView4);
tx3.setText("song.mp3");
mediaPlayer = MediaPlayer.create(this, R.raw.song);
seekBar = (SeekBar) findViewById(R.id.seekBar);
seekBar.setClickable(false);
b2.setEnabled(false);
b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Playing Now", Toast.LENGTH_LONG).show();
mediaPlayer.start();
finalTime = mediaPlayer.getDuration();
startTime = mediaPlayer.getCurrentPosition();
if (oneTimeOnly == 0){
seekBar.setMax((int) finalTime);
oneTimeOnly = 1;
}
/* Problem below line */
tx2.setText(String.format("%d min, %d sec",
TimeUnit.MILLISECOND.toMinutes((long) finalTime),
TimeUnit.MILLISECONDS.toMinutes((long) finalTime) -
TimeUnit.MINUTE.toSeconds(TimeUnit.MILLISECONDS.toMinutes())));
}
});
}
ショーは解決できません。テキストは赤色です。 Alt + Enterを適用しても動作しません。どのようにそれを解決した。
にsimplyfiedされます...親クラスとは何ですか? – MordechayS
Cann't understand –
あなたのIDEはどちらの方法に関係していますか? – MordechayS