lundi 5 octobre 2015

If - Else statement using the drawable of ImageView

Am trying to get the ImageView drawable and use it to create an if else statement, i have tried many solutions including the one below, all are not working they always give me the wrong Toast

if(holder.likeImage.getDrawable()==context.getResources().getDrawable(R.drawable.ic_action_like)){
                Toast.makeText(context, "LIKED ALREADY", Toast.LENGTH_SHORT).show();
            }

            else if(holder.likeImage.getDrawable()!=context.getResources().getDrawable(R.drawable.ic_action_like)){
                Toast.makeText(context, "YOU HAVNT LIKED", Toast.LENGTH_SHORT).show();


            }

Aucun commentaire:

Enregistrer un commentaire