Code example for Random

Methods: nextInt

0
	public DrawingView(Context context, AttributeSet attrs) {
		super(context, attrs);
 
		colors = new int[] { Color.BLUE, Color.CYAN, Color.GREEN,
				Color.MAGENTA, Color.YELLOW, Color.RED, Color.WHITE };
		random = new Random();
		nextColor = random.nextInt(colors.length);
		paint.setAntiAlias(true);
		paint.setColor(Color.WHITE);
		paint.setStyle(Paint.Style.STROKE);
		paint.setStrokeJoin(Paint.Join.ROUND);
		paint.setStrokeWidth(STROKE_WIDTH);
	} 
 
	/** 
	 * Erases the signature. 
	 */ 
	public void clear() { 
		for (Path path : paths) {
			path.reset();
		}