字幕表 動画を再生する 英語字幕をプリント HttpURLConnection is one HTTP client that you can use to make HTTP requests in Android. Now, you can also use third-party libraries that weren't created by Google. For example, OKHttp is a popular open-source HTTP client created by the Square Mobile Payments Company. They've done a lot of open-source work for Android. This class helps you send and receive data across the web using an HTTP connection. Once you have a URL, actually opening up an HTTP connection is actually pretty straightforward. You start by calling url.openConnection. Then to actually fire off the connection, and be ready to return results, you go ahead and you specify the RequestMethod. In this case, we're going to use the GET HTTP method. Then, you go ahead and call Connect and then finally, you call getInputStream on your connection which is going to be the input stream containing the results. Now, despite the of the codes that you see here, the Android platform is actually handling many of the complex networking details on to the hood for you. In other words, Android as an operating system is actually working with your device's hardware to setup connection and handled some of the physical steps that need to happen in order for the communication to work.