Good evening! I'm having difficulty retrieving the current image from my android imageView. It is an image to favor for the user (give like), and I want when the user clicks on that image, I check if the current image is = a heart icon with no fill, if yes then perform the tanking function, if otherwise, perform the descurtit function. In the current code the validation always exits as FALSE, even when it should be TRUE and the drawable variable is receiving=""
public void favoritar(){
Versiculos favoritar = new Versiculos();
SharedPreferencias preferencias = new SharedPreferencias(getApplicationContext());
Drawable drawable = imLike.getDrawable();
if (drawable.equals(R.drawable.ic_favorite_border)){
//Curtindo
favoritar.curtirVersiculo(idVersiculo, preferencias.getCHAVE_ID());
imLike.setImageResource(R.drawable.ic_favorite);
} else {
//Descurtindo
favoritar.descurtirVersiculo(idVersiculo, preferencias.getCHAVE_ID());
imLike.setImageResource(R.drawable.ic_favorite_border);
}
}
Thank you!