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

  • Home
  • SEARCH
  • 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 757165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:19:51+00:00 2026-05-14T15:19:51+00:00

Inside public class IAmHere extends Activity implements LocationListener { i have @Override public void

  • 0

Inside

public class IAmHere extends Activity implements LocationListener {

i have

@Override
public void onLocationChanged(Location location) {
    // TODO Auto-generated method stub

}

@Override
public void onProviderDisabled(String provider) {
    // TODO Auto-generated method stub

}

@Override
public void onProviderEnabled(String provider) {
    // TODO Auto-generated method stub

}

@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    // TODO Auto-generated method stub

}

and

inside

 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.iamhere);

i have

LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);    
    List<String> providers = lm.getProviders(true);  

    /* Loop over the array backwards, and if you get an accurate location, then break out the loop*/  
     Location l = null;  

    for (int i=providers.size()-1; i>=0; i--) {  
            l = lm.getLastKnownLocation(providers.get(i));  
            if (l != null) break;  
        }  

      double[] gps = new double[2];  
      if (l != null) {  
          gps[0] = l.getLatitude();  
          gps[1] = l.getLongitude();  
      }  

      gpsString = (TextView)findViewById(R.id.gpsString);

  String Data = ""; 
  String koordinata1 = Double.toString(gps[0]);
  String koordinata2 = Double.toString(gps[1]);
  Data = Data + koordinata1 + " | " + koordinata2 + "\n";
  gpsString.setText(String.valueOf(Data));

but seems it’s not working? Why? I mean even emulator doesn’t want to send GPS data – When I click “send” via UI or console, nothing happens…?

Thank you.

  • 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-14T15:19:51+00:00Added an answer on May 14, 2026 at 3:19 pm

    First, you implemented LocationListener on IAmHere, then did nothing with that interface.

    Second, you are calling getLastKnownLocation(), but you are doing nothing to trigger Android to start collection location data on any provider.

    These two problems are related.

    Location services are off until something registers to get location data from them. Typically, this is via requestLocationUpdates() on LocationManager…which uses the LocationListener interface you implemented.

    The recipe for using LocationManager is:

    1. Register a LocationListener via requestLocationUpdates()
    2. Unregister the LocationListener sometime (e.g., onDestroy()), so that you do not leak memory
    3. When location fixes come into onLocationChanged(), do something useful

    Here is a sample project that uses LocationManager and LocationListener in this fashion.

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

Sidebar

Related Questions

I am inside of... public class bgchange : IMapServerDropDownBoxAction { void IServerAction.ServerAction(ToolbarItemInfo info) {
How to declare a static dictionary object inside a static class? I tried public
Inside my page, I have the following: <aspe:UpdatePanel runat=server ID=updatePanel> <ContentTemplate> <local:KeywordSelector runat=server ID=ksKeywords
I have table inside a div tab. The table has 40 rows in it
When working with CSS inside of XML such as <span class=IwuvAS3></span> when parsed in
Inside a service, what is the best way to determine a special folder path
Inside my code I'm generating hashes of URLs, (which are practically of unbounded length).
Inside VS2005, our whole programming staff gets this error message sporadically and it is
Inside a windows batch file I'd like to figure out what the fully qualified
Working inside the context of an ASP.NET application I am creating a page that

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.