Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.ContentResolver;
import android.content.Context;

import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;

public class Main {
    /**
     * Is Roaming enabled.
     *
     * @return
     */
    @SuppressWarnings("deprecation")
    private static boolean isRoamingEnabled(Context ctx) {
        ContentResolver cr = ctx.getContentResolver();
        int result = 0; // 0 is false
        boolean check = false;

        try {
            result = Settings.Secure.getInt(cr, Settings.Secure.DATA_ROAMING);
        } catch (SettingNotFoundException e) {
            e.printStackTrace();
        }

        if (result == 1) {
            check = true;
        }

        return check;
    }
}