Back to Browse

Google Maps Nearby Places Tutorial | Part 3 ( Android Tutorials)

60.2K views
Jul 11, 2017
12:47

Souce code : https://goo.gl/FFYLcN This is a continuation to Google Maps tutorials series. There are 5 previous parts to this tutorial. But I created a separate series for this because this nearby places tutorial will take around 4-5 parts to complete. If you want to watch the previous parts the links are below : Nearby Places Tutorials : Part 1 : https://youtu.be/_Oljjn1fIAc Part 2 : https://youtu.be/ovlHW6Y1eQM Google Maps Tutorials : Watch previous parts HERE : Part 1 : https://youtu.be/Ot8D-GZ8qfY Part 2 : https://youtu.be/HD48FBwY9U0 Part 3 : https://youtu.be/rGkhzguavlc Part 4 : https://youtu.be/T2R9ETdd24Y Part 5 : https://youtu.be/AaLgEpDmJ6E Code for DataParser.java class : In the previous parts, we created the base for this tutorial. We first created a basic google maps activity where the default marker was set to Sydney, Australia. Then, in the next couple of parts we completed the get current location feature. In the last part, we created a search bar and a search button to search for a particular location in the google map. In this series, I will show you how to search nearby places like hospitals, restaurants, schools etc. I am going to show you just these 3 things but you can modify it according to your needs. In the first part, I created the 3 java classes that we need in this project. Then I added 3 buttons to the layout file to display hospitals, restaurants and schools. We set onClick properties and used switch case instead of using if-else. Then, we completed 2 of the classes which are DownloadUrl and DataParser. In the DownloadUrl class, we created readUrl() method which reads URL using HTTPURLConnection object and file handling methods such as input stream and Buffered Reader. Then after reading the url, we needed to parse it. So, we created Data parser class. This class contains 3 methods viz., getPlace(), getPlaces() and parse(). The parse() method will parse the data and pass it to getPlaces() method which will store it in form of List of HashMap. The getPlaces() method will fetch each place one by one using for loop and then call getPlace() method for each place. getPlace() method will convert the jsonArray to HashMap and add it to List of HashMap. In the next parts of this tutorial, we are going to complete the GetNearbyPlacesData class and also MapsActivity class. Find me here : Google+ : https://plus.google.com/u/0/b/105970252005982916681/105970252005982916681/posts Twitter : https://twitter.com/AndroidAcademy1 Facebook : https://www.facebook.com/AndroidAcademy8?ref=hl

Download

0 formats

No download links available.

Google Maps Nearby Places Tutorial | Part 3 ( Android Tutorials) | NatokHD