转自:http://www.bubuko.com/infodetail-831974.html
4.4(kitkat)之前:
<span style="font-size:24px;">ntent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
intent.setType("image/*");
activity.startActivityForResult(intent, START_ALBUM_CODE);</span>
或:
<span style="font-size:24px;">Intent intent = new Intent(Intent.ACTION_PICK, null);
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
"image/*");
activity.startActivityForResult(intent, START_ALBUM_CODE);</span>
<span style="font-size:24px;"><span style="color: rgb(63, 63, 63); font-family: 'Microsoft YaHei'; line-height: 30px;">可是在Android4.4上测试却出现问题了,获取不到正确的路径,获取的path是这样的:/document/image%3A29817,和我们正常的path:/mnt/sdcard/DCIM/100MEDIA/IMAG0021.jpg,不一样。</span>
</span>
<span style="font-size:24px;">
</span>
4.4之后:
<span style="font-size:24px;">ntent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,"image/*");
activity.startActivityForResult(intent, START_ALBUM_CODE);</span>
可以解决。更复杂的方法在http://blog.csdn.net/tempersitu/article/details/20557383#reply