Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;
import java.lang.reflect.Method;

public class Main {
    public static void samsungWimax(Context context, boolean state) {
        //http://forum.xda-developers.com/archive/index.php/t-909206.html
        Object samsungWimaxManager = context.getSystemService("WiMax");
        Method setWimaxEnabled = null;
        try {
            setWimaxEnabled = samsungWimaxManager.getClass().getMethod("setWimaxEnabled",
                    new Class[] { Boolean.TYPE });
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            if (state) {
                if (setWimaxEnabled != null) {
                    setWimaxEnabled.invoke(samsungWimaxManager, Boolean.TRUE);
                }
            } else {
                if (setWimaxEnabled != null) {
                    setWimaxEnabled.invoke(samsungWimaxManager, Boolean.FALSE);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}