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

The Archive Base Latest Questions

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

I am completely new to android, and pretty much a Java newb. I have

  • 0

I am completely new to android, and pretty much a Java newb.

I have a simple app that I am building to get the hang of android’s development environment – and things like click events, etc..

The app loads, and I am able to change the text in a textfield using a button handler. However, when I import the location class, and try to do a simple GPS call, the application crashes.

The problem is, everything looks good in Eclipse (error console) – and I’m not seeing any exceptions in the android emulator (DevTools). I have the logcat window open, but I haven’t done anything in eclipse/code to send logcat anything (do I need to?)

Can anyone see something wrong with this? Is there a better way to troubleshoot?

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.*;
import android.location.*;


public class locationDisplay extends Activity {

    private EditText text;
    private Location GPSLocation;
    double dblLat;
    double dblong;
    String strLat;


    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); // bind the layout to the activity
        text = (EditText) findViewById(R.id.EditText01);
        text.setText("No button pressed");

    }

    // Handler for each button -- Button01 is when it crashes
    public void myClickHandler(View view) {

        switch (view.getId()) {
        case R.id.Button01: 
            dblLat = GPSLocation.getLatitude();
            strLat = Double.toString(dblLat);
            text.setText(strLat);
            break;
        case R.id.Button02:
            text.setText("Button 2 was clicked");
            break;
        case R.id.Button03:
            text.setText("Button 3 was clicked");
            break;
        }
    }
  • 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-14T02:26:52+00:00Added an answer on May 14, 2026 at 2:26 am

    You shouldn’t need to write anything to get the default messages in LogCat; uncaught exception reports should appear automatically when your program crashes. However, sometimes LogCat and your emulator get disconnected from each other and the messages simply all disappear. Simply close Eclipse and the emulator, restart them both, and the messages should reappear. An easy way to tell whether the link has been re-established is during the boot-up of the emulator. Just as the flashing “ANDROID” text in the fancy font disappears bringing you to the lockscreen, you should see about a hundred lines of text flash by on LogCat. If that doesn’t happen, then LogCat isn’t getting its messages.

    The way to display debugging messages in Android is to use the Log.d("some name for your log statements so you can filter the LogCat messages", "The actual debug statement here");. You’ll often find people using things like a static final String LOG_TAG in their application so that they can make sure their logs always have the same tag, and hence, the filter never misses a message.

    As for your actual code here, Rpond is right, you never initialised your GPSLocation object.

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

Sidebar

Related Questions

I am completely new to Android development and have been reading many articles on
Completely new to java and I have been playing around with regex in a
I'm pretty new to android development, so I hope my question is easy, but
I'm new to Eclipse/Android development so I'm hoping this is something basic that I'm
I'm relatively new to Java, eclipse and android so this could be a completely
I have an app on the android market, which I periodically update with new
I'm completely new to Android development, but I just got a HTC Hero and
I'm completely new to Java/Android and am stuck with listviews. What I want is
I'm new to publishing Android apps. Our app's name and the string that users
I am new to Android and I have bound my application completely but I

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.