Java tutorial
//package com.java2s; import android.content.Context; import android.content.pm.PackageManager; public class Main { private static final String EXTERNAL_STORAGE_PERMISSION = "android.permission.WRITE_EXTERNAL_STORAGE"; private static boolean hasExternalStoragePermission(Context context) { int permission = context.checkCallingPermission(EXTERNAL_STORAGE_PERMISSION); return permission == PackageManager.PERMISSION_GRANTED; } }