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 6593701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:42:58+00:00 2026-05-25T17:42:58+00:00

Can someone help me out in navigating from some location to my current location

  • 0

Can someone help me out in navigating from some location to my current location ?

Actually I was able to see my current location on my application. But if I see another location which is far away from my current location in the Google map then I want to navigate to the current location by clicking on a Button.

I have a Menu Item in my Options menu called My Location. On click this Item I want to navigate to my location from the other location that I am watching on Google Maps.

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.mylocation:
                showCurrentLocation();
                return true;
            case R.id.menuItem1:
                showSatelliteView();
                return true;
            case R.id.menuItem2:
                showTrafficView();
                return true;
            case R.id.menuItem3:
                exitApplication();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    private void showCurrentLocation() {
       mapView.getController().animateTo(myLocationOverlay.getMyLocation());
    }

All the others are working fine. But when I click on My Location(id = mylocation) its giving exception on the Emulator.

It gives the following Error on my LogCat.

09-19 15:04:58.445: ERROR/AndroidRuntime(1634): Uncaught handler: thread main exiting due to uncaught exception
09-19 15:04:58.455: ERROR/AndroidRuntime(1634): java.lang.NullPointerException
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.google.android.maps.MapController.setCenter(MapController.java:345)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.location.mylocation.MyLocation.showCurrentLocation(MyLocation.java:126)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.location.mylocation.MyLocation.onOptionsItemSelected(MyLocation.java:108)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.app.Activity.onMenuItemSelected(Activity.java:2170)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:139)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:525)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.view.View.onTouchEvent(View.java:4179)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.widget.TextView.onTouchEvent(TextView.java:6540)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.view.View.dispatchTouchEvent(View.java:3709)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.os.Looper.loop(Looper.java:123)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at android.app.ActivityThread.main(ActivityThread.java:4363)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at java.lang.reflect.Method.invokeNative(Native Method)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at java.lang.reflect.Method.invoke(Method.java:521)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-19 15:04:58.455: ERROR/AndroidRuntime(1634):     at dalvik.system.NativeStart.main(Native Method)
  • 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-05-25T17:42:59+00:00Added an answer on May 25, 2026 at 5:42 pm

    Use LocationManager to obtain coordinates of current location and pass them to mapView.getController().animateTo(GeoPoint). Be aware when translating obtained Location to GeoPoint: the latitude and longitude obtained from Location should be multiplied by 1,e+6 (1 000 000).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please help me figure out a way to achieve the following (see
Can someone help me out with something. I'm trying to get the current part
Can someone help me figure out the following make file? BINS=file1 file2 file3 all:
Can someone please help me out with printing the contents of an IFrame via
Can someone please help me out with a JavaScript/jQuery solution for this arithmetic problem:
Perhaps someone can help me out with this one: I'm using a basic search
I am hoping someone can help me out with a quick question I have
Alright, I am hoping someone can help me out. I apologize up front that
I'm almost losing it, i really hope someone can help me out! I'm using
I am wondering if someone can help me figure out the best approach to

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.