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

The Archive Base Latest Questions

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

i am developing location based project where i am using the following code i

  • 0

i am developing location based project where i am using the following code

i am using google api 8 for the project

 lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
    currloc = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
    TextView t = (TextView)findViewById(R.id.textView1);
    try{
        t.setText("Your current location is - "+currloc.getLatitude()+","+currloc.getLongitude());
    }catch (Exception e) {
        // TODO: handle exception
        t.setText("cant find current location ");
    }

this code works fine on my galaxy tab even on htc

but when i use nexus it returns null value for location.
do i need to change my api level or is there any specific requirement for galaxy nexus
thank you in advance 🙂

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

    Please follow the line of code..

    Step1: into your oncreate
    
    LocationListener locationListener = new LocalLocationListener();
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
    
    Step2: into class body
    
    /**Listener on location change*/
    private class LocalLocationListener implements LocationListener
    {
    
        public void onLocationChanged(Location location)
        {
            String text = "My current Location is: "+location.getLatitude()+", "+location.getLongitude();
            GeoPoint geoPoint = new GeoPoint((int)(location.getLatitude()* 1E6), (int)(location.getLatitude() * 1E6));
            mapController_.animateTo(geoPoint);
            Toast.makeText(LocalMap.this, text, Toast.LENGTH_SHORT).show();
            Log.i("onLocationChanged", text);
    
        }
    
        public void onProviderDisabled(String provider)
        {
            // TODO Auto-generated method stub
            Toast.makeText(LocalMap.this, "GPS Disable", Toast.LENGTH_SHORT).show();
            Log.i("onProviderDisabled", "GPS Disable");
        }
    
        public void onProviderEnabled(String provider)
        {
            // TODO Auto-generated method stub
            Toast.makeText(LocalMap.this, "GPS Enable", Toast.LENGTH_SHORT).show();
            Log.i("onProviderEnabled", "GPS Enable");
        }
    
        public void onStatusChanged(String provider, int status, Bundle extras)
        {
            // TODO Auto-generated method stub
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I developing application which using geo-location. Should i ask user right for this when
Iam developing one application.In that i use the google api for getting the location
Iam developing one application.In that i use the google api for getting the location
I'm developing a web application using Wicket+Spring+JPA+Hibernate. This is my first project with this
I am developing an application in which i am using location service. Basically that
Currently developing an application using the newest version of symfony, obtained through PEAR. This
While developing a firefox extension, I create a wizard window from overlay.js using: this.wizard
I am currently developing a location based iPhone application. Is there any way to
I am developing an Augmented Reality app based on location. It is working perfectly
(this is in a Java project) I'm using a search engine in parallel with

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.