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

How to Stop extand Thread class In android?

i using call function to javascript to android . i using my android code below how to stop android mthread.i used for MyBackgroudMethod mThread but i want to stop this thread in sendCheckOutBackgroundKill();how to possible.please help me!!! public…
crickpatel0024
  • 1,999
  • 6
  • 30
  • 47
0
votes
0 answers

How can I program this UI to be smoother?

I collect data from a loop here: public void loop() throws ConnectionLostException, InterruptedException { led_.write(false); setCurrentAIVoltage0(AI0.getVoltage()); setCurrentAIVoltage1(AI1.getVoltage()); …
Timothy Frisch
  • 2,995
  • 2
  • 30
  • 64
0
votes
1 answer

SWT progress dialog while performing a long operation in the UI thread?

I have a long operation that cannot be moved from the SWT UI thread. I know, it's gross, but that's how it is. I would like to display a progress bar of some sort for said long operation. I have tinkered around with…
brock
  • 439
  • 1
  • 5
  • 17
0
votes
4 answers

Updating UI during AsyncTask

How can I edit the views of an activity from an AsyncTask BEFORE the task is complete? I cannot access any of the views from the doInBackground method, and I do not want to wait until the task has completed. Is there a way to go about doing this? …
Danny Buonocore
  • 3,731
  • 3
  • 24
  • 46
0
votes
1 answer

Removing View from layout, from GLRendering thread

Summary I'm trying to reliably remove a view from my layout, from my GL Rendering thread. Details I've got a splash screen which is added to my main layout, so my views are in this order: GLSurfaceView Splashscreen (which is a simple Android…
Zippy
  • 3,826
  • 5
  • 43
  • 96
0
votes
0 answers

Android Flush UI

Sometimes I've got situations that I want to make "light" operation like showing UI view and after that I want to show large set of UI views. I make it this…
Bystysz
  • 681
  • 1
  • 6
  • 8
0
votes
3 answers

If threads only can access static methods to a class with its own instance, created by a different thread, what thread will this execute on?

Suppose I have a class with 2 public static methods that control a single private instance of it's self. The basic structure of the class is below: public class MyClass { private static MyClass myclass = null; private final Process,…
Derek Ziemba
  • 2,467
  • 22
  • 22
0
votes
3 answers

UI Thread gets stuck even though I'm working on another

I have this code that on a click of a button a service will be started from a new thread and the service will start my TCP Client. The TCP client, once connected will send a count down event to inform the fragment to continue working. the code looks…
Yosi199
  • 1,745
  • 4
  • 22
  • 47
0
votes
2 answers

Executing two asynchronous tasks and updating AsyncTask message

I have a piece of code which connects to a server and then logs in. While these two tasks (connect to server and login) are being executed, a progress dialog appears. final ProgressDialog pd = new…
MC Emperor
  • 22,334
  • 15
  • 80
  • 130
0
votes
1 answer

ArrayAdapter need to be clear even i am creating a new one

Hello I'm having problems understanding how the ArrayAdapter works. My code is working but I dont know how.(http://amy-mac.com/images/2013/code_meme.jpg) I have my activity, inside it i have 2 private classes.: public class MainActivity extends…
Roi
  • 1,434
  • 2
  • 11
  • 13
0
votes
2 answers

Android UI Thread blocked in new Activity

I'm working on a small Android game that handles canvas drawing on a working thread. After the game is over this thread should start the next activity, but somehow the UI thread seems to get blocked by starting a new function. This is my games…
MA3o
  • 3
  • 2
0
votes
2 answers

Invoking a method on the UI thread, and the mysterious System.Windows.Forms.MethodInvoker.Invoke()

I'm trying to run code from worker threads by invoking it on the main UI thread; however, I don't have an instance of the main form or any controls (nor do I want one in the class where the threaded code is running). I've found things like the…
rory.ap
  • 34,009
  • 10
  • 83
  • 174
0
votes
1 answer

Display an XML on main thread

I have a little issue about a little thing I don't understand. It's just a simple request: how do I display an xml I just got in a thread? There is my method postData to get the xml, I make it display in a log.v as you can see below in the code,…
Nemka
  • 100
  • 11
0
votes
2 answers

Android while loop in asyntask on UiThread

I am working on App, in which i have 3 imageview and i want to do these imagesviews changes in loop continuously.
0
votes
3 answers

Android, call method in UI thread after restarting Activity due to configuration change (device rotation) does nothing

SITUATION: An application with resources for portait and landscape, has a simulator that I keep after configuration changes (the user can switch orientation while the simulation is running). @Override protected void onCreate(Bundle…
XaviGG
  • 171
  • 2
  • 19