android典型代码系列(十)------获取一个应用程序的权限信息(反射)

public class DemoActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { Class clazz =getClass().getClassLoader().loadClass("android.widget.AppSecurityPermissions"); Constructor constructor = clazz.getConstructor(new Class[]{Context.class,String.class});            Object object = constructor.newInstance(new Object[]{this,"cn.itcast.mobilesafe"});            Method method = clazz.getDeclaredMethod("getPermissionsView", new Class[]{});            View view = (View) method.invoke(object, new Object[]{});            setContentView(view);        } catch (Exception e) { e.printStackTrace(); }    }}