Eclipse and I aren't getting along. I have the following code (no where near completed), all of which is copied/pasted in from tutorials. Eclipse doesn't like it:
In the line:
Eclipse is generating a "Cannot instantiate the type LocationListener" error.
And the line:
Eclipse is generating a "Syntax error on tokens, Constructor header name expected instead"
When I make the requested changes, new errors pop up.
If Eclipse is right, please point me to a Location Listener tutorial with a fully operating Class that I can copy/paste into Eclipse as is so I can see from A - Z how it's done.
If Eclipse is wrong, please tell me how to fix it.
Code:
package us.glenedwards.postaltrack;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
public class MyLocation extends Service {
LocationListener locationListener = new LocationListener();
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 35000, 10, this.locationListener);
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
public void onCreate() {}
void myLocation() {
}
@Override
public int onStartCommand(Intent intent, int flags, int startid) {
myLocation();
return START_STICKY;
}
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
}
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
}
In the line:
Code:
LocationListener locationListener = new LocationListener();
And the line:
Code:
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 35000, 10, this.locationListener);
When I make the requested changes, new errors pop up.
If Eclipse is right, please point me to a Location Listener tutorial with a fully operating Class that I can copy/paste into Eclipse as is so I can see from A - Z how it's done.
If Eclipse is wrong, please tell me how to fix it.