safe Call Method Without Result - Android java.lang.reflect

Android examples for java.lang.reflect:Method Invoke

Description

safe Call Method Without Result

Demo Code


import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;

public class Main{
    static private final String TAG = ReflectionUtils.class.getSimpleName();
    @SuppressWarnings("unchecked")
    public static void safeCallMethodWithoutResult(Object object,
            Method method, Object... args) {
        try {/*  w ww .j ava2  s .c om*/
            method.invoke(object, args);
        } catch (Exception ex) {
            Log.w(TAG, ex);
        }
    }
}

Related Tutorials