我正在尝试使用相机拍照后更改Button属性。
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK) return;
Bitmap bitmap = utilities.decodeFile(path, 300);
imgPicHolder.setImageBitmap(bitmap);
//The pic is changing on the previous Activity, this works fine
Button button = (Button)findViewById(R.id.btnChange);
button.setText("NewText");
//Here is the problem, when trying to change the button property from the previous activity before taking the picture..
}
答案 0 :(得分:1)
我要做的是将String
从Activity2
传递到Activity1
再传递给Intent.putExtra()
,然后在Activity1
中使用getIntent().getStringExtra()
来回复此问题string
然后将其设置为Button
的{{1}}
Activity1
文字