我有一个游戏屏幕,在游戏中间,玩家可以通过点击按钮更改theri个人资料图片。单击该按钮时,将调用以下方法
private static final int SELECT_PHOTOA = 100;
public void chgImageA(View v){
System.out.println("...changing profile a");
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTOA);
}
然后在onActivityResult方法中,我有以下代码
@Override
protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
if (requestCode == SELECT_PHOTOA) {
if(responseCode == RESULT_OK){
Uri uri = intent.getData();
ImageButton pap= (ImageButton)findViewById(R.id.profileAButton);
pap.setImageURI(uri);
}
}
}
这会调用照片选择器并更改Imagebutton上的个人资料照片,但会重新启动调用此imagepicker活动的父活动。如何让第一项活动从何处恢复?任何帮助将不胜感激... thnakyou !!!