Return a value from a method : <p>I have this method to get the user location and I want to return <code>myLocation</code> variable : </p>

<pre><code>mFusedLocationClient.getLastLocation().addOnSuccessListener(new OnSuccessListener&lt;Location&gt;() {
        @Override
        public void onSuccess(Location location) {
            // Got last known location. In some rare situations this can be null.
            if (location != null) {
                double latitude = location.getLatitude();
                double longitude = location.getLongitude();

                LatLng mylocation = new LatLng(latitude, longitude);
            }
        }
    });
</code></pre>

<p>I have this method inside of a function that returns a LatLng value but I can't get the value from inside of the method.</p>
