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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:02:55+00:00 2026-06-04T08:02:55+00:00

I am developing an Android application. I am getting a list of latitudes and

  • 0

I am developing an Android application.

I am getting a list of latitudes and longitudes from the server.

I have to arrange those values based on my location. I mean the nearest latitude/longitude first and then the next one etc.

I have my latitude and longitude and the list of latitude and longitudes. How can I find the nearest one?

  • 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-04T08:03:00+00:00Added an answer on June 4, 2026 at 8:03 am

    This might not be the best way but it works 🙂

    public static final double PI = 3.14159265;
        public static final double deg2radians = PI/180.0;
        public static final double miles = 0.000621371192;
        public static final double kms = 0.001;
    
        public static double getDistance(double latitude1, double longitude1, double latitude2,double longitude2) {
    
             double distance;  
    
             Location locationA = new Location("point A");  
    
             locationA.setLatitude(latitude1);  
             locationA.setLongitude(longitude1);  
    
             Location locationB = new Location("point B");  
    
             locationB.setLatitude(latitude2);  
             locationB.setLongitude(longitude2);  
    
             distance = locationA.distanceTo(locationB); 
             double radd = distance * kms;
    
             return radd;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing android application in which i have to open option menu from
i am developing android applicaiton disply user overlays on map.user values getting from webservices
i am developing an android application to get a list of class from wevservice
I am developing an android application in which I have passed a string from
I am developing an android application in which I have to upload image from
im new one for android. im developing one application that application getting videos from
I am developing android application. In my application i have used sql server2008 R2.
I have been developing Android application for Android 3.x and now I want to
I have been developing the Android application and I use Timer and TimerTask objects
I have been developing Android application which has 3 ListView and one ContextMenu for

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.