Java tutorial
//package com.java2s; import android.content.Context; import android.content.pm.PackageManager; public class Main { public static boolean checkedPermission(Context context, String permission) { boolean rs = false; try { rs = (context.checkCallingOrSelfPermission( android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED); } catch (Exception e) { e.printStackTrace(); return false; } return rs; } }