Hello, I am a young student from cameroon.I like to be part of this
groupe.I am currently developing an application on android and I would
like your help because I have very problem.I want to receive the
coordinate GPS with android (  on the emulator). First, I have not a
supplier but I use the DDMS to generate coordinate.But I can not
receive GPS coordinates provided by the DDMS.This my code
    package android.phonedial;

    import java.util.List;
    import android.app.Activity;
    import android.content.Context;
    import android.location.Criteria;
    import android.location.Location;
    import android.location.LocationManager;
    import android.location.LocationListener;
    import android.location.LocationProvider;
    import android.os.Bundle;
    import android.widget.TextView;


    public class TestProviderController extends Activity {

    public    LocationManager locationManager;
    public LocationListener locationlistener;
        @Override
        public void onCreate(Bundle tracabilite) {
        super.onCreate(tracabilite);
        setContentView(R.layout.main);

        String location_context = Context.LOCATION_SERVICE;
        locationManager = (LocationManager)getSystemService
(location_context);

        testProviders();

        }
        public void testProviders() {

            TextView tv = (TextView)findViewById(R.id.myTextView);
            StringBuilder sb = new StringBuilder("Enabled
Providers:");
            List<String> providers = locationManager.getProviders
(true);


            for (String provider : providers) {
            locationManager.requestLocationUpdates(provider, 1000, 0,
            new LocationListener() {
            public void onLocationChanged(Location location) {}
            public void onProviderDisabled(String provider){}
            public void onProviderEnabled(String provider){}
            public void onStatusChanged(String provider, int status,
            Bundle extras){}
            });

             sb.append("\n").append(provider).append(": ");

            Location location = locationManager.getLastKnownLocation
(provider);



                if    (location != null)
                {
             double lat = location.getLatitude();
             double lng = location.getLongitude();
            sb.append(lat).append(", ").append(lng);
            } else {
                 sb.append("No Location");

            }
            }
            tv.setText(sb);
        }
    }
Please help me



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to