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
4
votes
4 answers

How to render usercontrols separately

I have a UserControl drawing the datacontext with Itemscontrol etc. I'm having three objects of the same usercontrol but with different datacontexts which is initialized on startup of the program. The problem is that the datacontext is so big so…
Numm3n
  • 1,021
  • 2
  • 9
  • 26
4
votes
3 answers

odata on silverlight runs on UI thread only

We're working with OData on Silverlight, using DataServiceCollection to get the data. All calls for fetching data (LoadAsync() LoadNextPartialSetAsync()) are done on a worker thread. However, the 'LoadCompleted' callback as well as deserialization…
Yaron
  • 2,053
  • 2
  • 19
  • 21
4
votes
3 answers

Can non-UI threads display to the screen?

Is only the UI-thread able to display to the screen, or can other threads do this as well?
richard
  • 12,263
  • 23
  • 95
  • 151
4
votes
1 answer

The method runOnUiThread(Runnable) in the type Activity is not applicable for the arguments (void)

I am trying to create a dialog from a non-UI thread, in onUtteranceCompleted(): runOnUiThread( new Thread(new Runnable() { public void run() { MyDialog.Prompt(this); } }).start()); Prompt() is a simple static method of the class…
an00b
  • 11,338
  • 13
  • 64
  • 101
4
votes
1 answer

How does the WM_PAINT get processed while Parallel.For is not finished yet?

There's some non-optimal code in a program like this (Pseudo code to give you an idea): public void button1_click() { picturebox1.Image = someBitmap; someBitmap.LockBits(...); Parallel.For(..., () => DoSomethingWith(someBitmap)); …
Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
4
votes
4 answers

Understanding UI thread

For example, there are a lot of tasks are posted to UI thread as follows. Handler handler = new Handler(Looper.getMainLooper()); handler.postDelayed(new Runnable() { @Override public void run() { // Some logic to display/update…
Uma Sankar
  • 449
  • 1
  • 8
  • 19
4
votes
1 answer

Setting TextView visible from another thread or BeginInvoke in Android

I'm developing an Android 2.2 application. I have an event listener on an activity, and I want to set visible a TextView when I receive an event. But there is an error: I only can set it visible from UI thread. In C# and Windows Mobile there is a…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
4
votes
3 answers

UI doesn't update until async method finishes

In my project I want to show a progress indicator, retrieve the data from the webservice and hide the progress indicator. If I do this I currently have to wait until I retrieved the data from the webservice and then the UI with the results is…
testing
  • 19,681
  • 50
  • 236
  • 417
4
votes
1 answer

SynchronizationContext.Send to call a Func returning a result

I have in a current project a simple component that can be dropped from the visual studio toolbox onto Forms and UserControls in WinForms application. It worked fine as is - and simply wraps the Send and Post methods of a SynchronizationContext…
NightCoder
  • 55
  • 1
  • 4
4
votes
1 answer

How to update the markers postions on real time

i am making a employee tracker in which i will fetch all employee current Lat long after every 30 sec and update on server and then Admin module will fetch the Lat-long of of each employee from server and update the eisting marker position. So…
4
votes
2 answers

Javafx Updating UI from a Thread without direct calling Platform.runLater

Nowadays some says it is not suitable to use Platform.runLater() for updating the UI from a non-JavaFX Thread and Oracle site introduce a way with bindings for progress bar updating. Here I want to update a Label, so coded it like this: Task task =…
Lalith J.
  • 1,391
  • 4
  • 16
  • 27
4
votes
1 answer

ios: UITableView reloadData not working until scroll

I've noticed a few questions similar to this one on SO but they all seem to end in the person was calling [self.tableView reloadData] Outside of the main thread. My problem is, I'm calling this on the main UI thread and I still don't get the new…
user1513171
  • 1,912
  • 6
  • 32
  • 54
4
votes
1 answer

Will handler.post(new Runnable()); create new Thread in Android?

I wrote a small app which changes application background every 3 sec. I used Handler and Runnable object to achieve this. It's working fine. Here is my code: public class MainActivity extends Activity { private RelativeLayout…
Pradeep
  • 2,530
  • 26
  • 37
4
votes
1 answer

Why does my Thread freeze the UI-Thread?

I cant figure it out. For what ever reason, this thread's code is actually running on the UI thread. If i break point it the UI stops. or Sleep it, UI stopped. and hence network activity is unallowed as its on the "ui" thread. Ive not used Async…
IAmGroot
  • 13,760
  • 18
  • 84
  • 154
4
votes
1 answer

Animating a View while ListView is scrolling not working

I'm trying to achieve the effect that the Google+ Android app has where there is a View that sits at the bottom of the screen, and when the user scrolls the ListView that sits behind it UP the View animates down, off screen. When the user scrolls…
Christopher Perry
  • 38,891
  • 43
  • 145
  • 187