Changes

Jump to: navigation, search

MAP524/DPS924 Lecture 7

208 bytes added, 13:02, 19 July 2015
no edit summary
= Using HTTP =
 
There are many reasons to connect to a server from your application - most often you'll want to retrieve content from the web to display and manipulate in your app.
 
Any network operation can potentially take a very long time, so you'll have to do all your network stuff in a separate thread or AsyncTask.
 
== Connecting ==
You'll need to use an [http://developer.android.com/intl/ja/reference/java/net/HttpURLConnection.html HttpURLConnection].
Any network operation can potentially take a very long time, so youIt'll have s possible to use both GET and POST to send parameters to do all your network stuff in a separate thread or AsyncTaskthe server, GET is easier as usual== Checking connectivity ==
Your app will get fewer bad reviews if it displays a good error message when a network is not available. See [http://developer.android.com/intl/ja/training/basics/network-ops/connecting.html#connection here] for a simple example of how to check the status of your connectivity.
// do something
}</source>
 
= Parsing XML =
 
= Reading and Writing JSON =

Navigation menu