I am trying to pass a boolean value to a map fragment so that location updates will be requested only when this boolean value is false.
The value of this boolean value changes on the event of a button click.
RequestLocationUpdatesListener (interface)
public interface RequestLocationUpdatesListener {
void onRequestLocationUpdates(boolean recording);
}
Requesting Location Updates (Main Activity)
// Turn on location updates and pass to fragment
mButtonRecord.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG_CONTEXT, "Start Recording clicked.");
mRequestLocationUpdates = true; // boolean value
mRequestingLocationUpdates = new RequestLocationUpdatesListener() {
@Override
public void onRequestLocationUpdates(boolean recording) {
recording = mRequestLocationUpdates;
mRequestingLocationUpdates.onRequestLocationUpdates(recording);
}
};
}
});
Map Fragment
The Log.i is never accessed in my MapFragment, what am I missing?
@Override
public void onRequestLocationUpdates(boolean recording) {
Log.i(TAG_CONTEXT, "Recording? = " + recording);
}