0
could help me with this android studio code ...I do not cosnigo recover the string to run if:
public void Green(View view) {
String cor3 = "verde";
Bundle parametros = new Bundle();
parametros.putString("verde",cor3);
Intent it = new Intent(this, Main3Activity.class);
parametros.putString("verde",cor3);
it.putExtras(parametros);
startActivity(it);
2nd screen
Intent intent = getIntent();
String verde = intent.getStringExtra("verde");
if ( cor=="verde"){
btn1.setBackgroundColor(Color.GREEN);
btn2.setBackgroundColor(Color.GREEN);
btn3.setBackgroundColor(Color.GREEN);
btn4.setBackgroundColor(Color.GREEN);
}
I spin the emulated and not funf
The problem is that you are receiving the value in the variable
verdeand in theifis using the variablecor. On the other hand it should use, for comparison, the methodequals()and not==.– ramaral