public final static int CONSULT_PICTURE = 100;
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, CONSULT_CAMERA);
if(resultCode==RESULT_OK && requestCode==CONSULT_CAMERA) {
Uri uri = data.getData();if (!TextUtils.isEmpty(uri.getAuthority())) {
//查询选择图片
Cursor cursor = getContentResolver().query(
uri,
new String[] { MediaStore.Images.Media.DATA },
null,
null,
null);
//返回 没找到选择图片
if (null == cursor) {
return;
}
//光标移动至开头 获取图片路径
cursor.moveToFirst();
String path = cursor.getString(cursor
.getColumnIndex(MediaStore.Images.Media.DATA));
//向处理活动传递数据
Toast.makeText(this, path, Toast.LENGTH_SHORT).show();
// Intent intent = new Intent(this, ProcessActivity.class); //主活动->处理活动
// intent.putExtra("path", path);
// //startActivity(intent);
// startActivityForResult(intent, GET_DATA);
}
}