Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9054153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:36:46+00:00 2026-06-16T13:36:46+00:00

I have tried following many tutorials on here and on Google, but it seems

  • 0

I have tried following many tutorials on here and on Google, but it seems like none of the tutorials relate to me.

Basically, so far, I have been able to display the mapview on my app, and implement the setBuiltInZoomControls. I just cant get the map to pinpoint the users current location like on google latitude.

I would like my app to detect my current position and then pinpoint it when i press a button.
I would show you guys what I have done so far with my codes, but after attempting many tutorials, I feel my codes are now too sloppy and incomplete to understand.

If there is any tutorial that I may have overseen, please send me the link. If not, can you please help steer me in the right direction?

Thanks guys, happy coding!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:36:51+00:00Added an answer on June 16, 2026 at 1:36 pm

    Using the current version of the Google Maps Android API v2, you can show your current position using this code:

    showCurrentPosition(myMap);
    

    Below is a code file with a the helper functions you can add to your Activity class:

    import com.google.android.gms.maps.CameraUpdate;
    import com.google.android.gms.maps.CameraUpdateFactory;
    import com.google.android.gms.maps.GoogleMap;
    import com.google.android.gms.maps.model.LatLng;
    
    import android.location.Criteria;
    import android.location.Location;
    import android.location.LocationManager;
    
    
    private LatLng getCurrentPosition(){
        // location details
        locationManager     = (LocationManager) getSystemService(LOCATION_SERVICE);
        Criteria criteria   = new Criteria();
        String bestProvider = locationManager.getBestProvider(criteria, false);
    
        Location location   = locationManager.getLastKnownLocation(bestProvider);
        LatLng posLatLon    = new LatLng(location.getLatitude(), location.getLongitude());
        Toast.makeText(this, "position: "+ location.getLatitude() + "," + location.getLongitude(), Toast.LENGTH_SHORT).show();
        return posLatLon;
    }
    
    private LatLng showCurrentPosition(GoogleMap map){
        LatLng posLatLon    = getCurrentPosition();
        CameraUpdate cam    = CameraUpdateFactory.newLatLngZoom(posLatLon, 12.0f);
        mMap.moveCamera(cam);
        return posLatLon;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried the following but it seems the folder gets created on the
I have tried following many articles and used many links in SO but I
I have tried the following MySQL update but it only sets the first field
I have tried the following: <%= image_tag '...path_to_img', :filter => alpha(opacity=50) %> But it
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,
I have no idea why this wont work but I have tried the following:
I have tried following queries to get my facebook fan page insights data SELECT
I have tried the following <input type=file name=upload multiple=multiple value=MyText> However the text on
I have tried the following program for writing the contents into Spreadsheet. I downloaded
I have tried the following code: $('a.buildMenu').click(function (event) { // Prevent normal behaviour event.preventDefault();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.