android - Passing Google Places Results into ListView -
i developing application displays taxi companies around you. home page map markers showing different cab companies. there way details such name, address , phone number listview
on next page? possible pass hashmap
details listview
, if so, how? can added class below shows map markers?
package com.example.chela.taxilocatorapplication; import java.util.hashmap; import android.os.asynctask; import android.util.log; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; import org.json.jsonobject; import java.util.list; public class placesdisplaytask extends asynctask<object, integer, list<hashmap<string, string>>> { jsonobject googleplacesjson; googlemap mmap; @override protected list<hashmap<string, string>> doinbackground(object... inputobj) { list<hashmap<string, string>> googleplaceslist = null; com.example.chela.taxilocatorapplication.places placejsonparser = new com.example.chela.taxilocatorapplication.places(); try { mmap = (googlemap) inputobj[0]; googleplacesjson = new jsonobject((string) inputobj[1]); googleplaceslist = placejsonparser.parse(googleplacesjson); } catch (exception e) { log.d("exception", e.tostring()); } return googleplaceslist; } @override protected void onpostexecute(list<hashmap<string, string>> list) { mmap.clear(); (int = 0; < list.size(); i++) { markeroptions markeroptions = new markeroptions(); hashmap<string, string> googleplace = list.get(i); double lat = double.parsedouble(googleplace.get("lat")); double lng = double.parsedouble(googleplace.get("lng")); string placename = googleplace.get("place_name"); string vicinity = googleplace.get("vicinity"); latlng latlng = new latlng(lat, lng); markeroptions.position(latlng); markeroptions.title(placename + " : " + vicinity); mmap.addmarker(markeroptions); } } }
(int = 0; < jsonarray.length(); i++) { jsongetcart = new parsegetcartfromorderlist(); jsongetcart.quantity = j jsongetcart.currency =jsonarray.getjsonobject(i).getstring("currency") cartlistfromorder.add(jsongetcart); }
do here cartlistfromorder arraylist , addin currency in can add name,phone no think , parsegetcartfromorderlist() model class
public class parsegetcartfromorderlist { public string locid; public string currency;}
and use class datatype in array list this
public static arraylist<parsegetcartfromorderlist> cartlistfromorder;
now can add data adapter using setter , getter`
Comments
Post a Comment