I am trying to show logs on a overlay over all activities. I found this https://stackoverflow.com/a/19037235/3370924 answer which implements the overlay in the application class. I have added a TextView to the LinearLayout to show my logs.
At first it works but then I get the error android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
when I have opened a new Activity and I am trying to add a new string to the TextView.
Usually i use runOnUiThread() but this method is not available in Application class. Can anyone please help me?
If we pretend that your
TextView
is calledtv
, do: