1
Good afternoon, I need to know how to read the color of the Button and store in a variable in java for Android platform but is showing errors, can help me ? Follow my code below:
private EditText cor;
public Button coreshexa;
coreshexa = (Button) findViewById( R.id.btn1);
cor = (EditText) findViewById( R.id.txtviewcorcateg);
ColorDrawable buttonColor = (ColorDrawable) coreshexa.getBackground();
cor.setText((CharSequence) buttonColor);
Which error is giving? and pass more code information, you are initiating variables in which method?
– Murillo Comino
When I click the button to read the background of the button it says that the application has stopped, only this command is showing error in the application, the idea is to make a color palette with buttons and read the hexadecimal of the chosen button
– Dev
Ola Matheus, you managed to solve by my answer?
– Murillo Comino