title: google maps - show current position coordinates
body: <p>I want to show coordinates from my current position on map. Here is the code and it doesn't work like it should. It only shows map within defined parameters, but when I click on button that shows my current position, nothing happens.
  I made this code using Android Studio tutorials on web.
  I am using Android studio and just a fresh learner.</p>
  
  <p>This is also what I get in event log when I run the app on my smartphone:</p>
  
  <blockquote>
    <p>21:56:48 Can't bind to local 8600 for debugger<br/>
    21:56:49 An established connection was aborted by the software in your host machine<br/>
             java.io.IOException: An established connection was aborted by the software in your host machine
             at sun.nio.ch.SocketDispatcher.write0(Native Method)
             at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
             at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
             at sun.nio.ch.IOUtil.write(IOUtil.java:65)
             at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
             at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
             at com.android.ddmlib.Client.sendAndConsume(Client.java:686)
             at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:349)
             at com.android.ddmlib.Client.requestAllocationStatus(Client.java:525)
             at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:569)
             at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:544)
             at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:360)
             at com.android.ddmlib.Devic... </p>
  </blockquote>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
  
  
      &lt;meta-data
          android:name="com.google.android.geo.API_KEY"
          android:value="@string/google_maps_key" /&gt;
  
      &lt;activity
          android:name=".MapsActivity_koordinate"
          android:label="@string/title_activity_maps"&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.gms.version"
          android:value="@integer/google_play_services_version" /&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>    package com.example.apollo.kartamackovec;
  
      import android.location.Location;
      import android.net.Uri;
      import android.support.v4.app.FragmentActivity;
      import android.os.Bundle;
      import android.widget.TextView;
      import android.widget.Toast;
  
      import com.google.android.gms.appindexing.Action;
      import com.google.android.gms.appindexing.AppIndex;
      import com.google.android.gms.common.ConnectionResult;
      import com.google.android.gms.common.api.GoogleApiClient;
      import com.google.android.gms.location.LocationServices;
      import com.google.android.gms.maps.CameraUpdateFactory;
      import com.google.android.gms.maps.GoogleMap;
      import com.google.android.gms.maps.OnMapReadyCallback;
      import com.google.android.gms.maps.SupportMapFragment;
      import com.google.android.gms.maps.model.LatLng;
      import com.google.android.gms.maps.model.MarkerOptions;
  
      public class MapsActivity_koordinate extends FragmentActivity implements     GoogleApiClient.ConnectionCallbacks,GoogleApiClient.OnConnectionFailedListener, OnMapReadyCallback, MapsActivity {
  
      public GoogleMap mMap;
  
      public GoogleApiClient client;
      public TextView mLongitudeText;
      public TextView mLatitudeText;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_maps);
          // Obtain the SupportMapFragment and get notified when the map is ready to be used.
          SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                  .findFragmentById(R.id.map);
          mapFragment.getMapAsync(this);
          // ATTENTION: This was auto-generated to implement the App Indexing API.
          // See https://g.co/AppIndexing/AndroidStudio for more information.
          client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
      }
  
  
      @Override
      public void onMapReady(GoogleMap googleMap) {
          mMap = googleMap;
  
  
          LatLng mackovec = new LatLng(46.4239, 16.4339);
          mMap.addMarker(new MarkerOptions().position(mackovec).title("Marker u Mačkovcu"));
          mMap.moveCamera(CameraUpdateFactory.newLatLng(mackovec));
          mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mackovec, 18));
          mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
          mMap.setMyLocationEnabled(true);
          }
          @Override
          public void onConnected(Bundle connectionHint) {
          Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation(client);
          if (mLastLocation != null) {
              mLatitudeText.setText(String.valueOf(mLastLocation.getLatitude()));
              mLongitudeText.setText(String.valueOf(mLastLocation.getLongitude()));
              Toast.makeText(this, "Location " + mLatitudeText+","+mLongitudeText,
                      Toast.LENGTH_LONG).show();
  
          } else {
              Toast.makeText(this, "noconnection",
                      Toast.LENGTH_LONG).show();
          }
  
      }
  
      @Override
      public void onConnectionSuspended(int i) {
  
      }
  
      @Override
          public void onStart() {
              client.connect();
              super.onStart();
  
              // ATTENTION: This was auto-generated to implement the App Indexing API.
              // See https://g.co/AppIndexing/AndroidStudio for more information.
              client.connect();
              Action viewAction = Action.newAction(
                      Action.TYPE_VIEW, // TODO: choose an action type.
                      "Main Page", // TODO: Define a title for the content shown.
                      // TODO: If you have web page content that matches this app activity's content,
                      // make sure this auto-generated web page URL is correct.
                      // Otherwise, set the URL to null.
                      Uri.parse("http://host/path"),
                      // TODO: Make sure this auto-generated app deep link URI is correct.
                      Uri.parse("android-app://com.example.apollo.kartamackovec/http/host/path")
              );
              AppIndex.AppIndexApi.start(client, viewAction);
          }
  
          @Override
          public void onStop() {
              client.disconnect();
              super.onStop();
  
              // ATTENTION: This was auto-generated to implement the App Indexing API.
              // See https://g.co/AppIndexing/AndroidStudio for more information.
              Action viewAction = Action.newAction(
                      Action.TYPE_VIEW, // TODO: choose an action type.
                      "Main Page", // TODO: Define a title for the content shown.
                      // TODO: If you have web page content that matches this app activity's content,
                      // make sure this auto-generated web page URL is correct.
                      // Otherwise, set the URL to null.
                      Uri.parse("http://host/path"),
                      // TODO: Make sure this auto-generated app deep link URI is correct.
                      Uri.parse("android-app://com.example.apollo.kartamackovec/http/host/path")
              );
              AppIndex.AppIndexApi.end(client, viewAction);
              client.disconnect();
          }
  
      @Override
      public void onConnectionFailed(ConnectionResult connectionResult) {
          Toast.makeText(this, "noconnection",
                  Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>