Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;

import android.provider.Settings;

public class Main {
    public static String getScreenTimeOutIndex(Context baseContext) {
        switch (getScreenTimeOut(baseContext)) {
        case 15000:
            return "0";
        case 30000:
            return "1";
        case 60000:
            return "2";
        case 120000:
            return "3";
        case 600000:
            return "4";
        case 1800000:
            return "5";
        case -1:
            return "-1";
        default:
            return "-1";
        }
    }

    public static int getScreenTimeOut(Context mContext) {
        return android.provider.Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.SCREEN_OFF_TIMEOUT, -1);
    }
}