Android: Manipulate A Variable's Value Inside Service Methods And Get From Different Activities
I implemented Service for listening user location: public class ListenLocationService extends Service { private final IBinder mBinder = new LocalBinder(); public interface ILo
Solution 1:
To achieve required result, Location userLocation
declaration should be moved to ListenLocationService
class.
To set new value to userLocation
, use this code: userLocation.set(location);
because userLocation = new Location(location);
cause remove final modifier error even if there's no final modifier.
Post a Comment for "Android: Manipulate A Variable's Value Inside Service Methods And Get From Different Activities"