Wednesday, February 1, 2012

Re: [android-developers] Re: android help

I'll look at this tomorrow unless somebody else does first...

By the way, this would be a really good time for you to go read up on
how to use the Eclipse debugger. This would allow you to put a
breakpoint on your onLocatoonChanged and see if it ever executes.

Additionally, if you don't get any errors, watch the log cat for
errors / warnings as your app executes..

kris

On Thu, Feb 2, 2012 at 2:43 AM, ajay talreja <ajayt059@gmail.com> wrote:
> have tried as you told to change "Try getting the location through a
> location update.  (Use
> requestLocationUpdate() or requestSingleUpdate() instead.)"
>
> but it is also not working for me........providing the code for your
> review......
>
> Code:
> "gps12.java "
> package d.gps12;
>
>
> 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.widget.TextView;
>
> public class gps12 extends Activity {
>    /** Called when the activity is first created. */
>        TextView t1,t2;
>    @Override
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        setContentView(R.layout.main);
>        LocationManager lm = (LocationManager)
> getSystemService(Context.LOCATION_SERVICE);
>        LocationListener ll = new mylocationlistener();
>        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
> ll);
>        t1=(TextView) findViewById(R.id.TextView01);
>        t2=(TextView) findViewById(R.id.TextView02);
>
>        t1.setText("hii");
>        t2.setText("hiiii");
>        }
>
>        private class mylocationlistener implements LocationListener {
>                public void onLocationChanged(Location location) {
>                    if (location != null) {
>                    t1.setText((int) location.getLatitude());
>                    t2.setText((int) location.getLongitude());
>
>                    }
>
>                    else
>                {
>                        t1.setText("unable");
>                    t2.setText("unable");
>
>
>
>                }
>                    }
>
>                public void onProviderDisabled(String provider) {
>        }
>        public void onProviderEnabled(String provider) {
>        }
>        public void onStatusChanged(String provider, int status,
> Bundle extras) {
>        }
>
> }
>        }
>
> After launching this application, I'm passing latitude and long.
> values from emulator and have also tried passing from command line
> through telnet ..but location values seems to be empty so.......the
> latitude and long. values are not getting displayed.........
> and the "text view" are not changing the values.....it means that
> "location changed " method is not getting execute neither its "if"
> part nor its "else" part......so what might be the problem........
>
>
> isn't the code correct or what might be the other
> problems..........???
> please get it run on your system.... help please......
>
> thanks........
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment