Using Proxy Behind WebView

its already a week that i search for the way to make webview works with proxy (not using wifi, just mobile ddata). i didnt found any solution yet. can someone give me something to work with it?

i already try all there's that in the SO (maybe not all, if someone have a way please share it)

take a peek at my code

 public class WebViewActivity extends Activity {

    static WebView web;
 String PROXY_IP = "";  
 int PROXY_PORT = 8989; 

    public void onCreate(Bundle savedInstanceState) {

        web = (WebView) findViewById(;
        web.setWebViewClient(new MyWebViewClient("username","password"));



        System.getProperties().put("proxySet", "true"); 
        System.getProperties().put(PROXY_IP, "");
        System.getProperties().put(PROXY_PORT, "8989");

        Authenticator authenticator = new Authenticator() { 

            public PasswordAuthentication getPasswordAuthentication() { 
            return (new PasswordAuthentication 

        web.setHttpAuthUsernamePassword("", "", "username", "password"); 



    public static boolean setProxyICSPlus(WebView webview, String host, int port, String exclusionList) {

         Log.d("", "Setting proxy with >= 4.1 API.");

           Class jwcjb = Class.forName("android.webkit.JWebCoreJavaBridge");
           Class params[] = new Class[1];
           params[0] = Class.forName("");
           Method updateProxyInstance = jwcjb.getDeclaredMethod("updateProxy", params);

           Class wv = Class.forName("android.webkit.WebView");
           Field mWebViewCoreField = wv.getDeclaredField("mWebViewCore");
           Object mWebViewCoreFieldIntance = getFieldValueSafely(mWebViewCoreField, web);

           Class wvc = Class.forName("android.webkit.WebViewCore");
           Field mBrowserFrameField = wvc.getDeclaredField("mBrowserFrame");
           Object mBrowserFrame = getFieldValueSafely(mBrowserFrameField, mWebViewCoreFieldIntance);

           Class bf = Class.forName("android.webkit.BrowserFrame");
           Field sJavaBridgeField = bf.getDeclaredField("sJavaBridge");
           Object sJavaBridge = getFieldValueSafely(sJavaBridgeField, mBrowserFrame);

           Class ppclass = Class.forName("");
           Class pparams[] = new Class[3];
           pparams[0] = String.class;
           pparams[1] = int.class;
           pparams[2] = String.class;
           Constructor ppcont = ppclass.getConstructor(pparams);

           updateProxyInstance.invoke(sJavaBridge, ppcont.newInstance("", 8989, null)); 

    } catch (Exception ex) {
        Log.e("","Setting proxy with >= 4.1 API failed with error: " + ex.getMessage());
        return false;

    Log.d("", "Setting proxy with >= 4.1 API successful!");
    return true;


    private static Object getFieldValueSafely(Field field, Object classInstance) throws IllegalArgumentException, IllegalAccessException {
        boolean oldAccessibleValue = field.isAccessible();
        Object result = field.get(classInstance);
        return result;      

    public void loadUrl(WebView view, String url, String proxyUserName, String proxyPassword){
        UsernamePasswordCredentials creds= new UsernamePasswordCredentials("username", "password");
        Header credHeader = BasicScheme.authenticate(creds, "UTF-8", true);
        Map<String, String> header = new HashMap<String, String>();
        header.put(credHeader.getName(), credHeader.getValue());
        view.loadUrl(url, header);

i already try using the public boolean ICS, using try and catch method. all isnt't showing any result (or i'm doing it wrong?). So please if someone have a way that's work using proxy in webview to show it the way.


Note: i'm running using mobile data. not Wifi. so the setting will be just for mobile data.


Need Your Help

TileList custom ImageCell, buttons/sprites on each image

actionscript-3 tilelist

Hi im trying to add some buttons or sprites on each of TileList items, i even made my own ImageCell class and inject some code that adds sprite on each image but it is not clickable - all clicks are

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.