Home > other >  "The first line of code" Android parses XML data format that section, the simulator can�
"The first line of code" Android parses XML data format that section, the simulator can�

Time:09-27

1, Windows 7 64 - bit PC structures, the apache server, the access on the PC 127.0.0.1 can see write their own get_data. XML documents;
2, on the simulator browser visit 10.0.2.2 can see get_data. The XML document.

But reference book, how also couldn't access the Web server, depressed, the great god grant instruction, many thanks!
Private void sendRequestWithOKHttp () {

New Thread (new Runnable () {
@ Override
Public void the run () {
Try {
OkHttpClient client=new OkHttpClient ();
Request the Request=new Request. Builder ()
Url (" https://10.0.2.2/get_data.xml ")
The build ();
The Response the Response=client. NewCall (request). The execute ();
String responseData=(https://bbs.csdn.net/topics/response.body). The String ();
ShowResponse (responseData);
//parseXMLWithPull (responseData);
} the catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}

CodePudding user response:

I also saw this, meet the same problem, the computer can access, mobile phone connection failure of life

CodePudding user response:

I also met
  • Related