/**
* 選擇圖片,2種實現(xiàn)方式
*/
public void pickBackgroundPicture() {
Logutil.e("pickBackgroundPicture");
// 只顯示拍的照片和擴展存儲根目錄下的圖片
Intent intent = new Intent(Intent.ACTION_PICK,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, REQUESTCODE_LOAD_IMAGE);
// 可顯示全部圖片,但可能會彈出選擇瀏覽圖片的應用選擇
/*Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, RESULTCODE_LOAD_IMAGE);
*/
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUESTCODE_LOAD_IMAGE:
if (resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData