Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import android.content.Context;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Main {
    private static boolean nvExtensionSupported;
    private static Method methodSetCursorVisibility;

    public static boolean setCursorVisibility(Context context, boolean visible) {
        if (!nvExtensionSupported) {
            return false;
        }

        try {
            methodSetCursorVisibility.invoke(context.getSystemService(Context.INPUT_SERVICE), visible);
            return true;
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        return false;
    }
}