Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gatlingxyz
Created July 2, 2014 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gatlingxyz/5d07d3cb7f8eef37f6a3 to your computer and use it in GitHub Desktop.
Save gatlingxyz/5d07d3cb7f8eef37f6a3 to your computer and use it in GitHub Desktop.
Hmm...
// this...
@Override
public void onMessageReceived(MessageEvent messageEvent) {
Log.v(TAG, "Message received on wear: " + messageEvent.getPath());
if(messageEvent.getPath().endsWith("connected")){
findViewById(R.id.progress).setVisibility(View.GONE); // Line #143
findViewById(R.id.on_off_layout).setVisibility(View.VISIBLE);
}
else{
findViewById(R.id.progress).setVisibility(View.VISIBLE);
findViewById(R.id.on_off_layout).setVisibility(View.GONE);
}
}
// causes this:
/*
07-01 21:07:32.335 2185-2196/? E/JavaBinder﹕ *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6075)
at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:889)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:4319)
at android.view.View.invalidate(View.java:11086)
at android.view.View.setFlags(View.java:9056)
at android.view.View.setVisibility(View.java:6176)
at android.widget.ProgressBar.setVisibility(ProgressBar.java:935)
at com.gatling.wearlifx.MainActivity.onMessageReceived(MainActivity.java:143)
at com.google.android.gms.wearable.internal.av.a(Unknown Source)
at com.google.android.gms.wearable.internal.ac$a.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment