공부해요/안드로이드

킷캣 , 갤러리 갱신

예쁜꽃이피었으면 2015. 1. 23. 18:13


검색어 ㅣ킷캣 , 갤러리 갱신



http://stackoverflow.com/questions/20265438/refresh-gallery-in-android-kitkat

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

    Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
    File f = new File("folderPATH", "fileName");
    Uri contentUri = Uri.fromFile(f);
    mediaScanIntent.setData(contentUri);
    appContext.sendBroadcast(mediaScanIntent);
} else {
    appContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory() + "/" + "FOLDER_TO_REFRESH")));
}

-> 안됨

반응형