I am writing a media player in which I am using Image buttons and Images are from system resource. Now in java file, how should it be addressed? here is the code:
case R.id.ib2:
if (isPlaying) {
pause();
//the red line is under R.drawable.ic_media_pause
playPause.setImageResource(R.drawable.ic_media_pause);
You need to use android's resource file, like so:
playPause.setImageResource(android.R.drawable.ic_media_pause);
Or You can add it to the imports if you aren't using any of your own resources:
import android.R;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With