Here you can find the source of setWebkitProxyICS(Context ctx, String host, int port)
private static boolean setWebkitProxyICS(Context ctx, String host, int port) throws Exception
//package com.java2s; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import android.content.Context; import android.util.Log; public class Main { private static boolean setWebkitProxyICS(Context ctx, String host, int port) throws Exception { // PSIPHON: added support for Android 4.x WebView proxy try {/*www . ja va2 s . c om*/ Class webViewCoreClass = Class .forName("android.webkit.WebViewCore"); Class proxyPropertiesClass = Class .forName("android.net.ProxyProperties"); if (webViewCoreClass != null && proxyPropertiesClass != null) { Method m = webViewCoreClass.getDeclaredMethod( "sendStaticMessage", Integer.TYPE, Object.class); Constructor c = proxyPropertiesClass.getConstructor( String.class, Integer.TYPE, String.class); if (m != null && c != null) { m.setAccessible(true); c.setAccessible(true); Object properties = c.newInstance(host, port, null); // android.webkit.WebViewCore.EventHub.PROXY_CHANGED = 193; m.invoke(null, 193, properties); return true; } else return false; } } catch (Exception e) { Log.e("ProxySettings", "Exception setting WebKit proxy through android.net.ProxyProperties: " + e.toString()); } catch (Error e) { Log.e("ProxySettings", "Exception setting WebKit proxy through android.webkit.Network: " + e.toString()); } return false; } }