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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:30:20+00:00 2026-05-24T22:30:20+00:00

I am trying to develop little application which at startup shows the name of

  • 0

I am trying to develop little application which at startup shows the name of current location in a toast or something. The code I wrote will show a Toast on the display with the location only is I send the coordinates manually from the Emulator Control View from Eclipse.

My question: Is there a way to force somehow this sending of coordinates at the startup, because I want that Toast when the application is loaded? And how can I do it? Thanks.

Here is the code:

public class HomeActivity extends Activity implements LocationListener {

    private LocationManager locationManager;
    private String welcomeMsg;
    private String crtLocationName;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        initLocationManager();
    }

    private void initLocationManager(){
        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 5000, this);
    }


     */
    @Override
    public void onLocationChanged(Location location) {
        if (location != null) {
            try {
                crtLocationName = getLocationName(location);

                Toast.makeText( getApplicationContext(), crtLocationName, Toast.LENGTH_LONG).show();
            } catch (IOException e) {
                welcomeMsg = "Location cannot be determined";
                crtLocationName = "";
            }

//          locationManager.removeUpdates(this);
        }
    }


    @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

    }

} 
  • 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-24T22:30:21+00:00Added an answer on May 24, 2026 at 10:30 pm

    As Emulator doesn’t have a GPS receiver, the method onLocationChanged will be only invoked when you give some new coordinates through DDMS.

    On the real phone, it will not show a Toast instantly; it will wait before it locates the GPS satellite and receive a GPS fix, then it will show the Toast message.

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

Sidebar

Related Questions

I'm trying to develop a little C# application (with MS Visual Express and SQL
I'm trying to develop an application that will use getImageData in javascript in Firefox
I am trying develop a basic referrer system to my Django website, system will
I am trying develop an Android app which uses Google maps. So for the
I'm trying to develop a little base CMS with CodeIgniter for my own use
Greetings, I'm trying to develop some tests for Mason components which requires running them
I am trying to understand how to develop stand-alone Javascript code. I want to
I an trying to develop a windows application using C# that can play streamed
I'm trying to develop a webapp with Restlet and I have a little problem
I'm trying to develop some code to make generic calls to methods by it's

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.