关于PopupWindow中,startActivityForResult后onActivityResult无反应
private OnClickListener buttonClick = new View.OnClickListener() {
public void onClick(View v) {
Intent intent = null;
switch (v.getId()) {
case R.id.backBtn:
BizEditSettingActivity.this.finish();
break;
case R.id.saveBtn:
getInfo = new GetBusinessInfo();
getInfo.execute();
break;
case R.id.biz_image:
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
myView = inflater.inflate(R.layout.popupwindow, null);
popupWindow = new PopupWindow(myView, LayoutParams.FILL_PARENT, 300, false);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
// 设置PopupWindow的弹出和消失效果
popupWindow.setAnimationStyle(R.style.popupAnimation);
albumsBtn = (Button) myView.findViewById(R.id.albumsBtn);
albumsBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent picture = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(picture, ConstantUtils.IMAGE_FROM_ALBUMS);
popupWindow.dismiss();
}
});
cancleBtn = (Button) myView.findViewById(R.id.cancleBtn);
cancleBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
popupWindow.dismiss();
}
});
popupWindow.showAtLocation(cameraBtn, Gravity.BOTTOM, 0, 0);
break;
}
}
};
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (resultCode) {
case ConstantUtils.IMAGE_FROM_ALBUMS:
if (resultCode == Activity.RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumns = { MediaStore.Images.Media.DATA };
Cursor c = this.getContentResolver().query(selectedImage, filePathColumns, null, null, null);
c.moveToFirst();
int columnIndex = c.getColumnIndex(filePathColumns[0]);
imagePath = c.getString(columnIndex);
c.close();
}
break;
default:
break;
}
}
问题的关系代码贴上了,搞了快一下午了,也没找到是哪的问题
[解决办法]
请问你这是访问相册吗?