Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

WebView android proxy -


i know how setting proxy manually , use in webview.

settings -> wireless networks ->mobile networks-> access point names->telkila. enter proxy server address , port (which 80). webview.enableplatformnotifications();

but can set proxy setting code? user didn't have set manually?

thanks

there no legal way change webview proxy settings programmatically. it's possible use java reflection change mproxyhost value android.net.http.requestqueue class. it's private value , there no setters it, reflection seems possible variant. used in project , works. here sample of method:

    private boolean setproxyhostfield(httphost proxyserver) {     // getting network           class networkclass = null;     object network = null;     try {         networkclass = class.forname("android.webkit.network");         field networkfield = networkclass.getdeclaredfield("snetwork");         network = getfieldvaluesafely(networkfield, null);     } catch (exception ex) {         log.e(proxymanager.class.getname(), "error getting network");         return false;     }     if (network == null) {         log.e(proxymanager.class.getname(), "error getting network : null");         return false;     }     object requestqueue = null;     try {         field requestqueuefield = networkclass                 .getdeclaredfield("mrequestqueue");         requestqueue = getfieldvaluesafely(requestqueuefield, network);     } catch (exception ex) {         log.e(proxymanager.class.getname(), "error getting field value");         return false;     }     if (requestqueue == null) {         log.e(proxymanager.class.getname(), "request queue null");         return false;     }     field proxyhostfield = null;     try {         class requestqueueclass = class.forname("android.net.http.requestqueue");         proxyhostfield = requestqueueclass                 .getdeclaredfield("mproxyhost");     } catch (exception ex) {         log.e(proxymanager.class.getname(), "error getting proxy host field");         return false;     }            synchronized (synchronizer) {         boolean temp = proxyhostfield.isaccessible();         try {             proxyhostfield.setaccessible(true);             proxyhostfield.set(requestqueue, proxyserver);         } catch (exception ex) {             log.e(proxymanager.class.getname(), "error setting proxy host");         } {             proxyhostfield.setaccessible(temp);         }     }     return true; }  private object getfieldvaluesafely(field field, object classinstance) throws illegalargumentexception, illegalaccessexception {     boolean oldaccessiblevalue = field.isaccessible();     field.setaccessible(true);     object result = field.get(classinstance);     field.setaccessible(oldaccessiblevalue);     return result;       } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -