我有两项活动。 核心和 MudaCor 。在核心我有四个按钮,在此处选择任何内容会尝试更改 MudaCor 中的按钮颜色并启动它,但Android模拟器会告诉我"错误应用"
public class MudaCor extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_muda_cor);
}
}
btnVermelho.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
img1.setBackgroundColor(getResources().getColor(corVerde));
img2.setBackgroundColor(getResources().getColor(corVerde));
img3.setBackgroundColor(getResources().getColor(corVerde));
img4.setBackgroundColor(getResources().getColor(corVerde));
Intent intent = new Intent(Cores.this, MudaCor.class);
startActivity(intent);
}
});