mozilla/MozStumbler — pull request #717 by keverets (2014-07-22 23:39:05+00:00)
Title: Fix a crash when the Application tries to update the MainActivity

Create a new Runnable to handle the UI update, as the Application
may not be running on the thread that created the view hierarchy.

This manifests as:

13573-13715/org.mozilla.mozstumbler E/AndroidRuntime﹕ FATAL EXCEPTION: Timer-3
Process: org.mozilla.mozstumbler, PID: 13573
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6220)
at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:848)
at android.view.View.requestLayout(View.java:16471)
at android.view.View.requestLayout(View.java:16471)
at android.view.View.requestLayout(View.java:16471)
at android.view.View.requestLayout(View.java:16471)
at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:352)
at android.view.View.requestLayout(View.java:16471)
at android.view.View.requestLayout(View.java:16471)
at android.widget.TextView.checkForRelayout(TextView.java:6609)
at android.widget.TextView.setText(TextView.java:3819)
at android.widget.TextView.setText(TextView.java:3677)
at android.widget.TextView.setText(TextView.java:3652)
at android.widget.ToggleButton.syncTextState(ToggleButton.java:81)
at android.widget.ToggleButton.setChecked(ToggleButton.java:75)
at org.mozilla.mozstumbler.client.MainActivity.updateUI(MainActivity.java:129)
at org.mozilla.mozstumbler.client.MainApp$ServiceBroadcastReceiver.onReceive(MainApp.java:202)
at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
at android.support.v4.content.LocalBroadcastManager.sendBroadcastSync(LocalBroadcastManager.java:278)
at org.mozilla.mozstumbler.service.scanners.cellscanner.CellScanner$1.run(CellScanner.java:112)
at java.util.Timer$TimerImpl.run(Timer.java:284)