android中有些时候我们在写代码时无法直接调用隐藏的API,这就需要用发射的方法来获得。下面通过一个java文件展示一个如何调用隐藏API的例子:
import android.app.Activity;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.Toast;
import android.widget.ToggleButton;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class TetheringDemo extends Activity implements CompoundButton.OnCheckedChangeListener {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {