@Override protected void onResume() { super.onResume(); map = MainActivity.map; // Clear tabs. tabHost = (TabHost) findViewById(R.id.tabHost); tabHost.setup(); tabHost.clearAllTabs(); // Clear signal data table. TableLayout table = (TableLayout) findViewById(R.id.signalsTable); table.removeViews(1, table.getChildCount() - 1); // Populates sensors list. sensors = BaseSensor.getRegisteredSensors(); charts = new HashMap<String, LineChart>(); // Initialize sensors. // After that, sensor will trigger sources events. checkboxs = new ArrayList<CheckBoxSource>(); for (BaseSensor sensor : sensors) { sensor.registerListener(this); try { sensor.init(); } catch (SensorNotSupportedException sne) { Toast.makeText(this, R.string.geomagnetic_sensor_error, Toast.LENGTH_LONG).show(); } } // Track lost focus event on x,y text inputs. findViewById(R.id.xText).setOnFocusChangeListener(this); findViewById(R.id.yText).setOnFocusChangeListener(this); findViewById(R.id.labelText).setOnFocusChangeListener(this); // Sets initial x, y values. float x = getIntent().getFloatExtra("x", 0f); float y = getIntent().getFloatExtra("y", 0f); getTextView(R.id.xText).setText(String.format(Locale.ENGLISH, "%.2f", x)); getTextView(R.id.yText).setText(String.format(Locale.ENGLISH, "%.2f", y)); currentPoint = getCurrentPoint(); getTextView(R.id.labelText).setText(currentPoint.getLabel()); // Loads point data (chart and table). loadChartData(); }