Code example for LatLng

Methods: toString

2
package com.example.googlemapdemo; 
 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.GoogleMap.OnMapClickListener; 
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.MarkerOptions; 
 
import android.location.Location; 
import android.os.Bundle; 
import android.support.v4.app.FragmentActivity; 
import android.support.v4.app.FragmentManager; 
import android.widget.TextView; 
 
public class MainActivity extends FragmentActivity implements OnMapClickListener, OnMapLongClickListener{ // TODO: use MapView
 
	private GoogleMap googleMap;
	Location myLocation;
	TextView textView;
 
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main); 
 
		textView = (TextView) findViewById(R.id.locinfo);
 
		FragmentManager fragmentManager = getSupportFragmentManager();
		SupportMapFragment mapFragment = (SupportMapFragment) fragmentManager
				.findFragmentById(R.id.map);
 
		googleMap = mapFragment.getMap();
 
		googleMap.setMyLocationEnabled(true);
		googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
		 
		googleMap.setOnMapClickListener(this);
		googleMap.setOnMapLongClickListener(this);
 
	} 
 
	@Override 
	public void onMapClick(LatLng point) {
		textView.setText(point.toString());
		googleMap.animateCamera(CameraUpdateFactory.newLatLng(point));
	} 
 
	@Override 
	public void onMapLongClick(LatLng point) {