Escolar Documentos
Profissional Documentos
Cultura Documentos
Questions
Tags
Users
sign up
Badges
Unanswered
log in
Ask
android
android-location
I'm trying to display both the longitude and latitude in seperate textviews after the user presses
the get location button. All code seems ok to me but am getting null pointer exceptions. I do not
want to do anything when the location is changed only when the user presses the button.
package com.seanhannon.fyp;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class FYPActivity extends Activity {
public Button getLocation;
public TextView LongCoord;
public TextView LatCoord;
public double longitude;
public double latitude;
The XML file is the usual with permissions for fine and coarse location etc.
Here is the Logcat output
share
order by votes
1 Answer
Asked
Dec 28 '11 at 17:21
share
5 33 46
Answered
Dec 28 '11 at 17:29
Thanks a mill, been few months since did any android so basics are gone totally Droid_Interceptor Dec 28
'11 at 17:39
most welcome,if it solved your problem, accept the answer. AAnkit Dec 28 '11 at 17:54
add a comment
Your Answer
log in
or
Name
By posting your answer, you agree to the privacy policy and terms of service.
meta chat tour help blog privacy policy legal contact us full site
Download the Stack Exchange Android app
2016 Stack Exchange, Inc