Advertisement
Guest User

Untitled

a guest
Aug 6th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. How to create a blinking line in android?
  2. canvas.drawLine(100,100,600, 600,mpaint);
  3.  
  4. boolean blink = false;
  5.  
  6. // Define paint objects
  7. Paint red = new Paint;
  8. red.setColor(Color.RED);
  9. Paint blue = new Paint;
  10. blue.setColor(Color.BLUE);
  11.  
  12. if(blink == false) {
  13. blink = true;
  14.  
  15. }
  16. else {
  17. blink = false;
  18. }
  19.  
  20. if(blink == true) {
  21. canvas.drawLine(100,100,600, 600,red);
  22. }
  23. else {
  24. canvas.drawLine(100,100,600, 600,blue);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement