Reputation: 509
In my application there are more than 10 activities.With the help of Location manager ,it updates all my changes in the location in a db.But it seems too difficult to code the same in all activities.Since the location updation is meant for whole application,is there is any solution in java so that code size can be effectively reduced?
Upvotes: 0
Views: 167
Reputation: 33792
Use inheritance?
public class LocationActivity extends Activity implements LocationListener {
...
}
public class BabyLocationActivity extends LocationActivity {
}
Or you could have your Application
class implement the the LocationListener
Or you could have it running in a Service
.
Upvotes: 1