내가 당신과 동일한 방법을 사용하지만, 대신 같은 데이터를 설정, 나는이 방법을했다 매우 비슷한 상황에 있었다 감사드립니다. 그리고 갤러리가 열리고 내가 묻는 것처럼 사진을 쓸어 넘길 수 있습니다.
Uri uri = GalleryPreviewButton.getImageContentUri(getContext());
Intent galeryIntent = new Intent(Intent.ACTION_VIEW);
galeryIntent.setDataAndType(uri, "image/*");
this.startActivity(galeryIntent);
이것은 파일에서 Uri를 가져 오는 데 사용한 방법입니다.
public static Uri getImageContentUri(Context context) {
String filePath = CURRENT_PATH;
Cursor cursor = context.getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[] { MediaStore.Images.Media._ID },
MediaStore.Images.Media.DATA + "=? ",
new String[] { filePath }, null);
if (cursor != null && cursor.moveToFirst()) {
int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
cursor.close();
return Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + id);
} else {
try{
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATA, filePath);
return context.getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
} catch (Exception e){
return null;
}
}
}
아무도 없습니까? 제발 :) – stage