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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:22:31+00:00 2026-05-22T03:22:31+00:00

In my application I’m trying to get the center coordinates of map when user

  • 0

In my application I’m trying to get the center coordinates of map when user scroll around the map.

I want to get the co-ordinates and set it on the text view.

Here is my code for that:

public boolean onTouchEvent(MotionEvent event) {
        int action=event.getAction();
        projection=mapView.getProjection();
        int X = (int)event.getX();          
        int Y = (int)event.getY();
        if(action==MotionEvent.ACTION_MOVE)
        {


            metrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(metrics);

            GeoPoint G = projection.fromPixels(metrics.heightPixels/2, metrics.widthPixels/2);
        //GeoPoint p=   mapView.getMapCenter();
            int lati=p.getLatitudeE6();
            Log.i("Lat : ",""+lati);
            Toast.makeText(this,""+lati,Toast.LENGTH_LONG);

            int longi=p.getLongitudeE6();
            Log.i("Lon : ",""+longi);
            Toast.makeText(this,""+longi,Toast.LENGTH_LONG);
            lat.setText(""+lati);
            lon.setText(""+longi);
        }
        return true;
    }
  • 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-22T03:22:32+00:00Added an answer on May 22, 2026 at 3:22 am

    Use this article:

    http://mobiforge.com/developing/story/using-google-maps-android

    It will answer all of your questions about using mapview.(mostly all). Plus for your particular need:

    search for “Getting the Location that was touched” on the page.

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

Sidebar

Related Questions

Application[temp] = 8; should set the value 8 to the key temp . However,
Our application takes text from a web form and sends it via email to
Application-Stack: Rails3, CanCan, Devise, Shoulda I've got some nested Resources and want to test
Application: This is a workshop proposal system for a conference. A user can create
Application running in django, apache, python and mysql: I want to create global variable
The application crashes on the row: [uids addObject:user.uid]; Who can tell why??
Application is asp.net MVC. I want to put a textbox for date using mask.
Application use NHibernate. I Have object A that contains set of objects B. I
application.rb config.time_zone = 'Athens' I want to list entries which are published between any
Application pool for my web service has Identity set to myDomain\myUser. When I run

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.