mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-19 09:54:15 +01:00
AndroidGCS: Because right now the object updated callbacks are not diconnected
when an activity goes away we need to check the view is valid when processing the object callbacks.
This commit is contained in:
parent
92209f8e42
commit
4bcac07c8c
@ -30,6 +30,7 @@ import org.openpilot.uavtalk.UAVObject;
|
||||
import org.openpilot.uavtalk.UAVObjectField;
|
||||
import org.openpilot.uavtalk.UAVObjectManager;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@ -72,7 +73,16 @@ public class SystemAlarmsFragment extends ObjectManagerFragment {
|
||||
if (DEBUG)
|
||||
Log.d(TAG, "Updated");
|
||||
if (obj.getName().compareTo("SystemAlarms") == 0) {
|
||||
Activity activity = getActivity();
|
||||
if (activity == null) {
|
||||
// TODO: Need to unregister all the callbacks
|
||||
return;
|
||||
}
|
||||
TextView alarms = (TextView) getActivity().findViewById(R.id.system_alarms_fragment_field);
|
||||
if (alarms == null) {
|
||||
// TODO: Need to figure out how to unregister all the callbacks
|
||||
return;
|
||||
}
|
||||
UAVObjectField a = obj.getField("Alarm");
|
||||
List<String> names = a.getElementNames();
|
||||
String contents = new String();
|
||||
|
Loading…
x
Reference in New Issue
Block a user