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
2 answers

Render Usercontrol while AutoResetEvent.WaitOne()

maybe it is a bad question, but I have a Client App which sends some Commands to the server. I made a little function for sending commands, which simply waits until a message is received over AutoResetEvent.WaitOne() and then returns the message as…
Tearsdontfalls
  • 767
  • 2
  • 13
  • 32
0
votes
3 answers

Android Network Operation on another Thread than UI

I am playing an stream from Internet and because long processes such as network operation should not be handled on UI Thread, I'm using AsyncTask. In Main Thread I set some specification of videoView: public void onCreate(Bundle icicle) { …
0
votes
1 answer

What's the appropriate GCD pattern for long-running tasks in viewWillAppear?

I have some long running tasks (IE retrieving complex data from a DB) that I need to run any time my view appears. I know for performance reasons I want to take my long running tasks off the main thread. I also know that I have to get back ON the…
Mike
  • 1,112
  • 1
  • 13
  • 20
0
votes
1 answer

How to display a string in a dialogs edit box from a UI Thread Classes Run() function

I have a Dialog-based Application. By default Visual Studio created an App and a Dlg class. I have added buttons, edit boxes, etc. to my dialog. When the user clicks the START button on my dialog it runs a 5 minute automated test and gives text…
The rookie
  • 25
  • 1
  • 4
0
votes
2 answers

Is it possible to run a quartz.net job on the UI thread?

I'm using Watin for browser testing, which has to run on the UI thread. I want to schedule a job using Quartz.NET but can't work out a way to run it on the UI thread (using a WPF application) Any ideas?
Chris Haines
  • 6,445
  • 5
  • 49
  • 62
0
votes
1 answer

XML SAX parsing not working in android 4.0 but in 2.x

I am using XML sax parsing for getting data through web-services. It working fine in 2.2 and 2.3 but not in higher versions like 4.x(ICS). Here my code is... btnlogin.setOnClickListener(new OnClickListener() { public void onClick(View…
0
votes
3 answers

Android NonUI Thread making application "not respond"

I am editing the code of an android app that is making GPS calls in a service. LocationListener. It also uses ServiceConnection In some views the device decides that my application is taking too long to respond, and that the user can either "Force…
CQM
  • 42,592
  • 75
  • 224
  • 366
0
votes
1 answer

GUIs inside Operating Systems

How do GUIs get built inside operating systems. Lets use two examples, say GTK+ in Ubuntu verses a Java JFrame. I thought that operating systems using some kind of graphical user interface would have to provide some system calls to be able to…
Matthew
  • 3,886
  • 7
  • 47
  • 84
0
votes
1 answer

how to change images from the url in ImageView automatically with some predefined time_interval?

THIS IS MY MAIN CLASS : $ `public class MainActivity extends Activity implements Runnable { ImageView im1,im2,im3; int b,p=0,j,k,l; String b1 ; Bitmap img; Bitmap bm; ArrayList arl = new ArrayList(); @Override public void…
0
votes
1 answer

How to freeze all running threads in iOS

I would like to free all running threads at some point to get callstack from UI Thread. Is there a method call for this? Thank you
ilker Acar
  • 401
  • 1
  • 5
  • 11
0
votes
2 answers

Progress window when doing computation in the UI thread

I would like to achieve this: Create a new window, which is just a spinning loader and some static text, and display it. Do some computation on the UI thread (it has to be done there) Close the loader window Currently, when I call .Show() on the…
Tomas Grosup
  • 6,396
  • 3
  • 30
  • 44
0
votes
2 answers

Updating Android UI

This function resides in a Service when called by an activity it should will generate a random number and add that to a ArrayList. Everytime a new item is added it will try to update UI via update which calls runOnUiThread to use these number to…
CatFish
  • 57
  • 1
  • 5
0
votes
2 answers

Android Displaying a Progress Dialog from a class which is not in the UI thread

I define this method in a RecordTable class, which is not an Activity. I call it from the main UI thread and pass a valid UI thread context as parameter. Of course, it does not work with the message: java.lang.RuntimeException: Can't create handler…
ilomambo
  • 8,290
  • 12
  • 57
  • 106
0
votes
2 answers

Show a Dialog inside a thread that it isn't GUI thread

I'm developing an Android 3.1 and above application. I have added a thread to make a REST request using Spring Framework. This is my code: public class FormsListActivity extends ListActivity { private List
forms; private ProgressDialog…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
-1
votes
1 answer

Understand Threading in Android(Update UI from another thread)

I was trying to understand the threading in android. As we know, we can't update a view from background thread. I was trying to understand with different cases and came across a case below. When I clicked on the Start work button, I created a thread…