String hex1 = "#FF00FF00"; //BLUE with Alpha value = #AARRGGBB
int a = Integer.valueOf( hex1.substring( 1, 3 ), 16 );
int r = Integer.valueOf( hex1.substring( 3, 5 ), 16 );
int g = Integer.valueOf( hex1.substring( 5, 7 ), 16 );
int b = Integer.parseInt( hex1.substring( 7, 9 ), 16 );
Toast.makeText(getApplicationContext(), "ARGB: " + a + " , " + r + " , "+ g + " , "+ b , Toast.LENGTH_SHORT).show();
String hex1 = "#FF0000"; //RED with NO Alpha = #RRGGBB
int r = Integer.valueOf( hex1.substring( 1, 3 ), 16 );
int g = Integer.valueOf( hex1.substring( 3, 5 ), 16 );
int b = Integer.parseInt( hex1.substring( 5, 7 ), 16 );
Toast.makeText(getApplicationContext(), "RGB: " + r + " , "+ g + " , "+ b , Toast.LENGTH_SHORT).show();