Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Google Maps Search in mao

@Overrideprotected Void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
Object view;
}
public void onSearch(View view)
{
EditText location=(EditText)findViewById(R.id.location);
String location1=location.getText().toString();
List addressList=null;
if (location1 != null || !location1.equals(" ")) {
Geocoder geocoder=new Geocoder(this);
try {
addressList= geocoder.getFromLocationName(location1,1);

} catch (IOException e) {
e.printStackTrace();
}
Address address=addressList.get(0);
LatLng latLng=new LatLng(address.getLatitude(),address.getLongitude());
mMap.addMarker(new MarkerOptions().position(latLng).title("Marker in Sydney"));
mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
}
}


This post first appeared on AR Programming, please read the originial post: here

Share the post

Google Maps Search in mao

×

Subscribe to Ar Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×