Android Fragment页打开相册

1 按钮点击响应里添加

Intent albumIntent = new Intent(Intent.ACTION_PICK, null);
                albumIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
                startActivityForResult(albumIntent, SELECT_PHOTO);

2 重新onActivityResult方法

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
      
    }

你可能感兴趣的:(android)