I am currently using the @android:drawable/presence_online as the srcCompat for a ImageView.
I would like to change it programmatically to @android:drawable/presence_offline.
I tried the code below but it didn't work.
final ImageView imgPresence = (ImageView) findViewById(R.id.imgPresence);
imgPresence.setImageResource(R.drawable.presence_offline);
Any ideas?
You missed android in the resource id.
Instead of
imgPresence.setImageResource(R.drawable.presence_offline);
use this:
imgPresence.setImageResource(android.R.drawable.presence_offline);
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