Private void loadxml (string Uri, string filename ){
Httpclient httpclipost = NULL;
Httpget = new httpget (URI );
Try {
Httpclipost = m_tools.createhttpclient ();
// Httpget = NULL;
// Send an HTTP request
// Httprequest. setentity (New urlencodedformentity (null, HTTP. utf_8 ));
// Get http Response
Httpresponse = httpclipost.exe cute (httpget );
// If the status code is 200 OK
/// Log. D ("service statuscode", "" +
// Httpresponse. getstatusline (). getstatuscode ());
If (httpresponse. getstatusline (). getstatuscode () = 200 ){
// Retrieve the response string
String strresult = entityutils. tostring (httpresponse
. Getentity ());
Fileoutputstream outstream = getactivity (). openfileoutput (
Filename, context. mode_private );
Outstream. Write (strresult. getbytes ());
Outstream. Close ();
} Else {
}
Httpget. Abort ();
} Catch (exception e ){
}
If (httpclipost! = NULL ){
Httpclipost. getconnectionmanager (). Shutdown ();
}
}
/***
* Create an httpclient
**/
Public httpclient createhttpclient (){
Httpparams Params = new basichttpparams ();
Connmanagerparams. setmaxtotalconnections (Params, 10 );
Httpprotocolparams. setversion (Params, httpversion. http_1_1 );
Httpprotocolparams. setcontentcharset (Params,
HTTP. default_content_charset );
Httpprotocolparams. setuseexpectcontinue (Params, true );
Httpconnectionparams. setconnectiontimeout (Params, 30000 );
Httpconnectionparams. setsotimeout (partams, 30000 );
Schemeregistry schreg = new schemeregistry ();
Schreg. Register (New Scheme ("HTTP", plainsocketfactory
. Getsocketfactory (), 80 ));
Schreg. Register (New Scheme ("HTTPS ",
Sslsocketfactory. getsocketfactory (), 443 ));
Clientconnectionmanager conmgr = new threadsafeclientconnmanager (
Params, schreg );
Return new defaulthttpclient (conmgr, Params );
}