Questions tagged [ui-thread]

In some frameworks there's a dedicated thread that exclusively manages all UI objects. It's the developer's responsibility to use this thread for UI updates (e.g. adding, updating and removing controls).

In some frameworks (.Net, Android, iOS, Java Swing etc.) there's a dedicated thread that exclusivly creates and manages all the UI objects. Only this thread is allowed to modify UI objects (add, remove, set text on the button, etc). Other threads usually just post a request to make such modifications.

UI thread must never be paused for long with slow task (like communication over network or something computation intensive) as this would make all GUI non-responsive.

References

599 questions
0
votes
1 answer

white screen when using runOnUiThread

I am having an experiment of onTouchListener. The aim is to move the FrameLayout to wherever I touch. The 1st version of code gives me a “viewroot$calledfromwrongthreadexception” error. So in the 2nd version, I try to use runOnUiThread to solve the…
0
votes
3 answers

TimerTask crashes when changing Fragment

I have a TimerTask running inside one of the fragment of my app; when I try to switch dinamically to another fragment using the "fragmentManager.beginTransaction().replace" method my app crashes. I'm sure that my issue is linked with the Timer…
Moltehh
  • 247
  • 1
  • 3
  • 12
0
votes
1 answer

App not responding while transfer data

I am sending image using Socket Server and Client. It gived me dialog "App not responding" i think beacuse converting this bitmap was making in UiThread. So i tried to change it but i am still getting this message "App is not responding". It's…
user3465277
  • 219
  • 3
  • 10
0
votes
2 answers

Thread that is not UiThread

I am using a Thread to start my ServerSocket and I with transactions that take longer than 500ms. I think that triggers some "App is not responding" messages. I tried to create a thread that to separate it from the UiThread. Here is my code: Thread…
user3465277
  • 219
  • 3
  • 10
0
votes
1 answer

android.view.ViewRoot$CalledFromWrongThreadException in badge view

I am create an app which is get the notify count from server, that service part working fine. In that count i was showed in badge view this also fine. when i click the badgeview that time i have the issue followed Logcat 04-09 10:46:11.741:…
Pandiyan Muthu
  • 1,040
  • 4
  • 21
  • 39
0
votes
1 answer

Weird things happen in the main thread in Xamarin.mac

I have a method and something weird is happening public void UpdateProgressBar(double newValue) { // Make sure we don't go over the maximum value for the progress bar if (newValue > _maxValueProgressBar) …
user2984254
  • 109
  • 1
  • 7
0
votes
1 answer

Null Pointer exception in timer inside android fragment

I have a Fragment Home.java in the MainActivity which has view pager images. I've used a timer to schedule the automatic sliding of the images inside this viewpager. Whenever I click on the back button on the device to exit the application, I get…
MAK
  • 1,250
  • 21
  • 50
0
votes
1 answer

How to call a RESTful Method from Android?

I've tried two different ways to call a simple REST method from Android; said REST method - which works from other clients - simply returns an int val such as 17. Both of the following attempts were based on code I found online. One is like…
0
votes
5 answers

Threads, loadImageFromNetwork - Unfortunately has stopped

My application does not give any compile-time error and it does show the activity like it show. It is a simple activity with a button. When the user clicks on it, it should download an image from the network. When I click on the button, it just…
Solace
  • 8,612
  • 22
  • 95
  • 183
0
votes
1 answer

Android: On resuming Activity, unable to post Runnable on Activity's View

I have an Activity with a TextView, and I set the label and color of the TextView each time a background thread invokes a method on the Activity. It works properly until I leave the Activity and re-enter it. In that case, the TextView is not updated…
MidnightJava
  • 1,927
  • 2
  • 18
  • 38
0
votes
2 answers

Android Service Destroy NullPointerException

I have a application with activity and service. public class ClsService extends Service { private NotificationManager notificationManager; @Override public IBinder onBind(Intent intent) { return null; …
Trxplz0
  • 371
  • 1
  • 2
  • 13
0
votes
1 answer

How to setup an AsyncTask to update a bunch of progress bars?

I have a bunch of UI being updated by a loop that is constantly being called. However it seems to get bogged down; how would I go about using a AsyncTask to make it a bit quicker? Here is the loop for the UI: class Looper extends BaseIOIOLooper { …
Timothy Frisch
  • 2,995
  • 2
  • 30
  • 64
0
votes
1 answer

Dos and Don'ts with UI Thread

I am newer to Multi Threaded applications in C#. While i am working on it i have learnt about UI Thread which take care of application UI. Now am in a bit confusion in What to do with UI Thread and What should not do. Task.Factory.StartNew(() => …
Prasanth
  • 99
  • 2
  • 10
0
votes
1 answer

How could Android Service handle 'long-running' operations while it's running on UI thread

I added some network socket code in the onStartCommand() method of my implementation of Service class. But I got NetworkOnMainThread exception. Some folks suggested that a Service runs on UI thread, which makes sense to me. However the doc says…
wizoleliam
  • 83
  • 3
  • 13
0
votes
3 answers

getPackageName() returns null

I have a method in my android app that returns the drawable id according to it's name, this method works so well in the normal cases, but when running it from a separate thread it returns Null, even when running this thread on the UIThread. This…
MRefaat
  • 515
  • 2
  • 8
  • 22