Alright so how when i click a button? it will change the a image to a different image
my xml of the image i want to change when button press:
<ImageView
android:id="@+id/bluebtn1"
android:src="@drawable/buttonblue"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginLeft="33dp"
android:layout_marginTop="140dp"></ImageView>
and here is my java code ill be doing when you press the button
case R.id.redbtn1:
if (lvl1.getText().equals("1")) {
lvl1.setText("2");
// Here is where the code goes to change the image
} else {
Toast.makeText(main.this, "YOU LOSE!", Toast.LENGTH_SHORT).show();
}
break;
Put this in your click listener.
This should work.