i finally reached an app that get's the GPS position of the user, but
i reached it implementing LocationListener. it works fine, but i need
to do it without implementing it, because i have to do a class that
doesn't implement methods.

I searched for a lot of tutorials and check a lot of websites and i
try to transform my code to not implement LocationListener but i can't
do it, every thing i tested broken my app and stop getting the GPS
position of the user.

Please, if someone expert on this can transform my code for not be
using "implements LocationListener" i'll be grated to him

this is the code to transform:


    public class GpsMiniActivity extends Activity implements
LocationListener{

    private LocationManager mLocMgr;
    private TextView tv1;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        FrameLayout rl = new
FrameLayout(this.getApplicationContext());
                LinearLayout ll= new LinearLayout(this.getApplicationContext());
                ll.setOrientation(LinearLayout.VERTICAL);

                setContentView(rl);
                rl.addView(ll);

                tv1=new TextView(getApplicationContext());
                ll.addView(tv1);

        //setContentView(R.layout.main);
        mLocMgr = (LocationManager)
getSystemService(LOCATION_SERVICE);
        mLocMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER,
                500, 0, this);
    }
    @Override
    public void onLocationChanged(Location location) {
        tv1.setText("Lat " +   location.getLatitude() + " Long " +
location.getLongitude());
    }
    public void onProviderDisabled(String provider) {}
    public void onProviderEnabled(String provider) {}
    public void onStatusChanged(String provider, int status, Bundle
extras) {}
    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to