title: Google Maps Android API V2 showing current location with marker(where am i in google android maps api v2)
body: <p>I am beginner in android , i am developing an android app for displaying my current location on google maps.But as i run my application it display a message "Unfortunately stopped" on emulator as well as physical device.
  i am attaching my code .plz have a look.
  pls help me ....i am not able to resolve this</p>
  
  <p>thanks</p>
  
  <p><em><strong>MainActivity.java</em></strong></p>
  
  <p>package com.example.mapp;</p>
  
  <pre><code>import android.app.Dialog;
  import android.location.Location;
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.view.Menu;
  import android.widget.TextView;
  
  import com.google.android.gms.common.ConnectionResult;
  import com.google.android.gms.common.GooglePlayServicesUtil;
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.GoogleMap.OnMyLocationChangeListener;
  import com.google.android.gms.maps.SupportMapFragment;
  import com.google.android.gms.maps.model.LatLng;
  
  public class MainActivity extends FragmentActivity implements OnMyLocationChangeListener {
  GoogleMap googlemap;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          int status=GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());
          if(status!=ConnectionResult.SUCCESS)
          {
              int requestCode=10;
              Dialog dialog=GooglePlayServicesUtil.getErrorDialog(status,this, requestCode);
              dialog.show();
          }
          else
          {
              SupportMapFragment fm = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map));
                      googlemap=fm.getMap();
                      googlemap.setMyLocationEnabled(true);
                      googlemap.setOnMyLocationChangeListener(this);
          }
      }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  @Override
  public void onMyLocationChange(Location location) {
  
      TextView tvLocation=(TextView)findViewById(R.id.textview1);
      double latitude=location.getLatitude();
      double longitude=location.getLongitude();
      LatLng latLng=new LatLng(latitude,longitude);
      googlemap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
      googlemap.animateCamera(CameraUpdateFactory.zoomTo(15));
      tvLocation.setText("Latitude:"+latitude+",Longitude:"+longitude);
  }
  
  
  }
  </code></pre>
  
  <p><em><strong>AndroidManifest.xml</em></strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.mapp"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="17" /&gt;
       &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
   &lt;permission android:name="com.example.mapp.permission.MAP_RECIEVE" android:protectionLevel="signature"/&gt;
      &lt;uses-permission android:name="com.example.mapp.permission.MAP_RECIEVE"/&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
      &lt;!-- External storage for caching. --&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
       &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.example.mapp.MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="MY_API_KEY" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>*<strong>activity_main.xml*</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
  
      tools:context=".MainActivity" &gt;
  
      &lt;TextView
          android:id="@+id/textview1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"/&gt;
          &lt;fragment
  
          class="com.google.android.gms.maps.SupportMapFragment"
          android:id="@+id/map"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true"
          android:layout_alignTop="@+id/textview1"
  
         /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>