Advertisement
arinado

setImageDrawable

Feb 25th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1.         colour.setOnClickListener(new View.OnClickListener() {
  2.             int i = 1;
  3.             @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
  4.             @Override
  5.             public void onClick(View v) {
  6.                 cap.setImageDrawable(Drawable.createFromPath("res/drawable/cap"+i+".png"));
  7.                 i++;
  8.                 if (i==9) i=1;
  9.             }
  10.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement