![]() The first one will be BASE_URL and I'll paste in that string. Within the interface, I'll create two constants. The kind of file I'm creating won't actually be a class, it'll be an interface and it won't implement any other interfaces. I'll start by copying this URL to the clipboard, then I'll go back to Android Studio and then in my base package, I'll create a new Java class and I'll name it MyWebService. ![]() Now, my goal is to retrieve this data in my Android app over the web and I'm going to use Retrofit and another library called Gson to do it. And there are many different values in there. There's an item name, a category, a description, a price and so on. Each item in the JSON dataset has a number of values. In this example, I'll be working with a JSON-formatted dataset and you can find it at this web page. One of these is an open source library named Retrofit created by the folks at Square. Making web service calls to RESTful web services can take quite a bit of code but there are some great tools available that make it a lot easier.
0 Comments
Leave a Reply. |