Android Development Series logs-(5)

Source: Internet
Author: User

1. Obtain network text
1. Java code
Create a URL object
Call openconnection () to obtain an httpurlconnection object.
Setconnectiontimeout ()
Get Response Code getresponsecode ()
Getinputstream ()
Read data
Convert to string
2. UI scrolling
Scrollview
Horizontalscrollview

2. Obtain network images
1. function implementation
It is very similar to the text, but after reading the data, it is converted into bitmap. bitmapfactory. decodebytearray ()
2. Cache
After reading data from the server, the data is cached locally.
The last modification time is included in the next request.
The server determines the modification time. If 200 or 304,304 is returned, the server reads the cache. If 200 is returned, the server data is updated and downloaded again.

Iii. JSON
1. What is JSON
JSON is also a way to carry data, similar to XML. The advantage is that it is small.
2. How to resolve
Create a jsonarray object using a string
Traverse the jsonarray object to obtain each jsonobject.
Get data from jsonobject


14 15 17 do not upload a blog

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.