String colorString = "#FF0000"; int color = Color.parseColor(colorString);
String colorName = "red"; int color = Color.parseColor(colorName);This example uses the parseColor() method to convert the color name "red" to its integer representation. This is useful when working with predefined color names in your app. Both examples use the android.graphics.Color class and are part of the Android SDK platform.