Java tutorial
//package com.java2s; import android.content.Context; public class Main { private static boolean hasExternalStoragePermission(Context context) { int perm = context.checkCallingOrSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE"); return perm == 0; } }