Android错误:sendUserActionEvent()mView == null

时间:2017-10-10 07:49:42

标签: java android

public void onActivityResult(int requestCode, int resultCode, Intent data) {

    super.onActivityResult(requestCode, resultCode, data);
    if(resultCode == GALLERY){
        if (data != null) {

            Bitmap photo = (Bitmap) data.getExtras().get("data");
            imageView.setImageBitmap(photo);
        }
}

1 个答案:

答案 0 :(得分:0)

声明布尔值并设置为true

public boolean Counter = true;


public void setImage()
{
  while (Counter)
  continue;
  imageView.setImageBitmap(photo);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {

super.onActivityResult(requestCode, resultCode, data);
if(resultCode == GALLERY){
    if (data != null) {

        Bitmap photo = (Bitmap) data.getExtras().get("data");
        Counter = false;
    }

}