Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * TouchAccessibitily, an accessibility service that helps people with cerebral palsy to access Android devices. You can only click if you press more than two seconds.
 * 
 * Copyright (C) 2014 Marta Guasch
 * 
 * This file is part of TouchAccessibility.
 * 
 * TouchAccessibility is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 2 of the
 * License, or (at your option) any later version.
 * 
 * TouchAccessibility is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * 
 * See the GNU General Public License for more details. You should have received a copy of the GNU
 * General Public License along with TouchAccessibility. If not, see <http://www.gnu.org/licenses/>.
 * 
 * Authors: TODO
 */

import android.text.TextUtils;

import java.lang.reflect.Field;

public class Main {
    public static Field getField(Class<?> targetClass, String name) {
        if (targetClass == null || TextUtils.isEmpty(name))
            return null;
        try {
            return targetClass.getDeclaredField(name);
        } catch (SecurityException e) {
            // ignore
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }
        return null;
    }
}