android - How do I create a new activity for each city? -


forgive me being new android app building.

my plan build app take city , open new activity it. problem don't know how go that. plan similar how app yik yak go put marker in area , brings activity location. believe yik yak shows ones close plan take activity location. possible way or should take yik yak's route on , show things within radius of you?

where can started on learning how that?

first, need choose provider maps.

i google map start suggested in tag, beware, might not available on chinese devices without play services. can follow documentation here quick start https://developers.google.com/maps/documentation/android/

regarding number of pins want put on map, see no problem display lot of them, have group markers user zooms out, don't have 10 pins overlapping themselves. if in quite zoomed state, user clicks group of markers, can display dialog choose city. if user zooms in lot , clicks particular pin, can start activity.

your main concern listening zoom level change, that:

mmap.setoncamerachangelistener(new oncamerachangelistener() {       private float currentzoom = -1;      @override      public void oncamerachange(cameraposition pos) {         if (pos.zoom != currentzoom){             currentzoom = pos.zoom;             // action here          }      }  });  

credits: https://stackoverflow.com/a/15046761/689710

then, can create map of lists, keys of map custom lat / long object. let's call pin. pin provides custom iscloseto method (taking zoomlevel in params, , other pin object).

for each city want add on map     each key in map         if pin object of city iscloseto pin key of map             add list key         else             add new map entry city pin key , list city value 

you pin.iscloseto method somehow similar that:

https://stackoverflow.com/a/18170277/689710

returning true or false according "dist" return , zoom level.

when processed cities, can browse map , create marker each pin key.

in zoomed in state, have map lists containing 1 item, don't think it's problem.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -