Android Internet Development)

Source: Internet
Author: User

Address: http://www.cnblogs.com/linzheng/archive/2011/01/23/1942365.html

 

1. Java socket programming introduction http://www.cnblogs.com/linzheng/archive/2011/01/23/1942328.html

II. Introduction to URL and urlconnection Network Programming

Iii. Introduction to HTTP Network Programming

HTTP protocol-Overview HTTP protocol-C # obtain webpage source code HTTP protocol-multi-thread File Transfer

Iv. Web Service Network Programming

V. Introduction to network programming for Android webview

Instance code -----------------------------------------------

Code

Code package COM. amaker. socket; import Java. io. ioexception; import Java. io. outputstream; import java.net. serversocket; import java.net. socket;/*** socket server, which writes Hello android to the client! */Public class myserver {public static void main (string [] ARGs) {try {serversocket Server = new serversocket (8888); While (true) {Socket Client = server. accept (); outputstream out = client. getoutputstream (); string MSG = "Hello android! "; Out. Write (msg. getbytes (); client. Close () ;}} catch (ioexception e) {e. printstacktrace ();}}}

 

Server Simulation

Myserver. Java

Code

Loginservlet. Java

Code

Web. xml

<? XML version = "1.0" encoding = "UTF-8"?>
<Web-app version = "2.4"
Xmlns = "http://java.sun.com/xml/ns/j2ee"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemalocation = "http://java.sun.com/xml/ns/j2ee
Http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd>
 
 
<Servlet>
<Servlet-Name> loginservlet </servlet-Name>
<Servlet-class> com. Amaker. http. loginservlet </servlet-class>
</Servlet>

<Servlet-mapping>
<Servlet-Name> loginservlet </servlet-Name>
<URL-pattern>/servlet/loginservlet </url-pattern>
</Servlet-mapping>

</Web-app>

Android Client

Mainactivity. Java

Code

Androidmanifest. xml

Code

I. socket programming

Testsocketactivity. Java

Code

Socket. xml

Code

Ii. url and urlconnection Programming

Testurlactivity. Java

Code

Test_url.xml

Code

Iii. Http Programming

Loginactivity. Java

Code

Http1.xml

Code

4. Web Service Programming

Testwebserviceactivity. Java

Code

Weatheractivity. Java

Code

Webserviceutil. Java

Code

Weather. xml

Code

V. webview Programming

Testwebviewactivity. Java

Code

Test_webview.xml

Code
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.