Google maps go somewhere random


#1

i am not familiar with maps.
i m trying to do when i click a button google map will go to random place.
how can i do it.thanks


#2

Are you wanting to go to a random place based off a list of places or a random place anywhere in the world?


#3

yup random place anywhere in the world.i figure out it.thanks solved.


#4

By selecting a random point in the globe you will end up 71% of the times in the ocean, right?


#5

mm actually i dont know because i didnt use maps before.so i dont know how to use it still.
my solution is litte bit different.
i make a list with all cities in the world.
when button click selecting a random item from cities list and maps go there
so i never end up oceans:)


#6

this may have happened that Google map API key was missing in Upfront option
from aaron


#7

have you verified the presence of Google map API key in upfront option…???
from aaron


#8

Please analyse the following code first , to get a basic knowledge and grip on how to use maps in android …make your foundations very strong…

import com.google.android.gms.maps.;
import com.google.android.gms.maps.model.
;
import android.app.Activity;
import android.os.Bundle;

public class MapPane extends Activity implements OnMapReadyCallback {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_activity);

    MapFragment mapFragment = (MapFragment) getFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}

@Override
public void onMapReady(GoogleMap map) {
    LatLng sydney = new LatLng(-33.867, 151.206);

    map.setMyLocationEnabled(true);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13));

    map.addMarker(new MarkerOptions()
            .title("Sydney")
            .snippet("The most populous city in Australia.")
            .position(sydney));
}

}


#9

thanks for useful info.


#10

welcome ,once carefully going through the above and analyzing ,it helps to establish the solution
and feel feel to ask any further questions