Issue
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);
Solution
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;
Answered By - Chris Stillwell
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.