判断Android系统时间是否是24小时制

次方法判断Android系统时间是否是24小时制:

 

public static boolean is24(Context ctx){

   ContentResolver cv = ctx.getContentResolver();

       String strTimeFormat = android.provider.Settings.System.getString(cv,

       android.provider.Settings.System.TIME_12_24);

   if(strTimeFormat!=null&&strTimeFormat.equals("24")){//strTimeFormat某些rom12小时制时会返回null

           return true;

   }else return false;

    }

你可能感兴趣的:(android)