From b2707856aba4fc9b063f26305f1fb603b19c1701 Mon Sep 17 00:00:00 2001 From: satok Date: Wed, 23 Mar 2011 23:18:49 -0700 Subject: Added InputConnectionCompatUtils and EditorInfoCompatUtils Change-Id: Ie69d5e90c4ee978d3ecb40b68e6466082569ca7a --- java/src/com/android/inputmethod/compat/CompatUtils.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'java/src/com/android/inputmethod/compat/CompatUtils.java') diff --git a/java/src/com/android/inputmethod/compat/CompatUtils.java b/java/src/com/android/inputmethod/compat/CompatUtils.java index 07db4a1bb..a8086919c 100644 --- a/java/src/com/android/inputmethod/compat/CompatUtils.java +++ b/java/src/com/android/inputmethod/compat/CompatUtils.java @@ -20,6 +20,7 @@ import android.content.Intent; import android.text.TextUtils; import android.util.Log; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -90,6 +91,19 @@ public class CompatUtils { } } + public static Constructor getConstructor(Class targetClass, Class[] types) { + if (targetClass == null || types == null) return null; + try { + return targetClass.getConstructor(types); + } catch (SecurityException e) { + // ignore + return null; + } catch (NoSuchMethodException e) { + // ignore + return null; + } + } + public static Object invoke( Object receiver, Object defaultValue, Method method, Object... args) { if (receiver == null || method == null) return defaultValue; -- cgit v1.2.3-83-g751a