The HttpURLConnection and URL classes are members of the java.net package. As I described earlier, we’re using the Android implementations of these classes, but the code you use to call them is the same as for all Java-based platforms. I’m going to wrap the code in its own class, to make it as reusable as possible.
- [Instructor] I now have the infrastructure in place…to wrap http requests in background threads.…And so now I'll show how to use…the http URL connection class.…I'll be using a standard bit of java code…that isn't unique to Android.…The http URL connection and URL classes…are members of java.net.…When I call them, I'm using the Android implementation…but the API is the same, regardless…of which Java platform you're working in.…I'll be creating this bit of code in its own class…to make it as reusable as possible.…
I'll go to my utils package that I already created…and I'll create another new class…and I'm going to name it http helper.…As with network helper, this class…is going to contain static methods.…Now I need a good bit of code so I've…created a gist that I can copy from.…I'll go to a browser and I'll navigate to git.io/v13pg.…I'll go to a browser and I'll navigate to git.io/v13pg.…All lowercase.…And that expands to this gist.…And I'll select and copy all of the code.…
Then I'll return to Android studio,…I'll delete everything except the package declaration,…
IInstructor David Gassner starts with an overview discussion about available networking strategies, and then dives into how to declare networking permissions, make network requests, handle responses, parse data returned from a web service, and pass user credentials to services that support HTTP basic authentication. He also provides an overview of popular higher-level networking libraries, including OkHttp and Picasso, and offers recommendations for improving performance in network-connected apps. David also covers using static feeds, using dynamic PHP pages hosted on a public server web service, and integrating apps with network data storage.
- Integrating mobile apps
- Communicating with Android
- Preventing app freezes with background threads
- Preparing an app for network communication
- Declaring permissions
- Checking network connectivity
- Retrieving data over the web
- Using traditional APIs
- Using third-party libraries
Skill Level Intermediate
Android App Development: Communicating with the Userwith Joe Marini1h 12m Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
Android App Development: Unit Testingwith James P White2h 58m Intermediate
Google Firebase for Android: First Lookwith Joe Marini1h 16m Intermediate
1. Getting Started
2. Manage Multithreading in Android
3. Requesting Data over the Web
4. Working with Binary Responses
5. Sending Data to Web Services
6. Manage HTTP Requests with Libraries
7. Manage RESTful APIs with Retrofit 2
Next steps1m 14s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.