1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +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:
James Cotton 2012-08-10 02:01:27 -05:00
parent dec044d0fa
commit 91a8186e54

View File

@ -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();