首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

java 反照机制的笔记

2013-10-12 
java 反射机制的笔记package com.test.democlass Demo {? ? public interface Listener {? ? ? ? onCallba

java 反射机制的笔记

package com.test.demo

class Demo {

? ? public interface Listener {

? ? ? ? onCallback();

? ? }

}

Log.v(TAG, "output : " + Demo.class); ? ===> ? "output : class com.test.demo.Demo"

Log.v(TAG, "output : " + Listerer.class); ?===> ?"output : interface com.test.demo.Demo$Listener?"

?

?

public static final String WPS_LISTENER = "android.net.wifi.WifiManager$WpsListener";Method method = WifiManager.class.getMethod("startWps", WpsInfo.class, Class.forName(WPS_LISTENER));Log.d(TAG, "startWps, method : " + method);method.invoke(wifiManager, wpsInfo, mWpsListener);

System.out.print(Class.forName("java.lang.String").newInstance().getClass().getName());

?

?

热点排行