How to create an Android Color from a hexadecimal/HTML string (#fff) alvin January 15, 2016 - 12:13pm

Android FAQ: How can I create a Color from a hexadecimal color string in Android?

The Android Color.parseColor method

Solution: Use the Android Color.parseColor method, like this:

int color = Color.parseColor("#519c3f");

I just used it like this in my code, where I directly set the Paint color:

How to draw a rectangle in Android (using onDraw method of View)

Android FAQ: How do I draw a rectangle in Android?

To draw a rectangle in Android you’ll need to create your own View, i.e., a class that extends the Android View class. For example, this CustomView shows how to extend a View and then use the Rect and Paint classes along with the onDraw method to draw a rectangle:

Scala/Java 2D: How to draw lines and arcs

This code may not make much sense without seeing the end result, but ... the following source code shows how to draw lines and arcs in Scala and Java: