Android App2014. 10. 28. 14:12

기존 킷켓 이전에는

 

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));

 

이렇게해서 겔러리를 갱신했었지만

 

킷캣부터 이렇게 바꼈다

private void galleryAddPic() {
    Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
    File f = new File(mCurrentPhotoPath);
    Uri contentUri = Uri.fromFile(f);
    mediaScanIntent.setData(contentUri);
    this.sendBroadcast(mediaScanIntent);
}

 

대신에 저 photoPath에 경로를 주는것이 아니라 업로드한 사진 경로 풀경로를 줘야 한다는것이다. 파일이름까지

 

참고 : http://www.codeproject.com/Questions/689342/Refresh-gallery-in-android-kitkat

Posted by 동동(이재동)