Android examples for User Interface:View
Check if View is Opaque via reflection
//package com.java2s; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main { public static boolean view_isOpaque(Object viewChild) { boolean opaque = true; try {/*w ww. j av a2 s. co m*/ Method[] methods = viewChild.getClass().getDeclaredMethods(); Method method = null; for (Method m : methods) { if ("isOpaque".equals(m.getName())) { method = m; method.setAccessible(true); break; } } if (null != method) { opaque = (Boolean) method .invoke(new Object[] { (Object) null }); } } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } return opaque; } }