Is there anyway to compare s to a? In this code I have int s as the answer and if the drawable == s then I want to display a \"Correct!\" toast mes
drawable == s
\"Correct!\"
try this
public void MyClick(View view) { Drawable fDraw = view.getBackground(); Drawable sDraw = getResources().getDrawable(R.drawable.twt_hover); if(fDraw.hashCode() == sDraw.hashCode()) { //Not coming } }
or use following code
Use getTag() and setTag() for comparison