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
-1
votes
1 answer

onPostExecute gets called too late

First I will describe the process/problem briefly in words. Afterwards, I'll attach all of the code. I start the android application in debug mode. Main activity gets called. It calls Activity2 via "intent". Then (in onCreate) I start an Async…
user5095266
  • 119
  • 2
  • 7
-1
votes
1 answer

Using AsyncTask but the app crushes

You can see three AsyncTask derived classes that are inner to EditProductActivity class. This class allows me to get the product details when I onclick the item on the listview then I can edit the product details and save it or I can delete it.…
Calvin Ng
  • 33
  • 4
-1
votes
1 answer

ProgressDialog disappear before everything is loaded

i'm sorry for the weird title but i didn't find other ways to explain that. In a Fragment i have a ProgressDialog that has to be shown till every instructions inside the Fragment are completed. The problem is that it disappear 5 seconds before the…
Giorgio Antonioli
  • 15,771
  • 10
  • 45
  • 70
-1
votes
2 answers

Comparing text in android

im trying to compare a text in android to avoid refreshing texts if it's not necessary (otherwise the texts for different fields are refreshed every 50ms). With normal texts it is not a problem. Everything works fine. But: If there are numbers in…
Selucky
  • 3
  • 3
-1
votes
1 answer

Application momentarily hangs main thread

I am trying to connect to a SFTP server using WinSCP and vb.net. Everything goes well and the file uploads/downloads correctly but after it has finished, if I interact with the form in any way (ie. Pressing a button) the main thread hangs for about…
dylanpdx
  • 15
  • 1
  • 1
  • 5
-1
votes
1 answer

Is it possible to simulate Silverlight UI thread (to reproduce deadlock scenario)?

I have a library with legacy code that causes a deadlock in a Silverlight application. What makes it harder to investigate is that it's only Silverlight app that fails. When used in WPF or Windows Store application, the same code runs fine (this a…
Vagif Abilov
  • 9,835
  • 8
  • 55
  • 100
-1
votes
1 answer

Android: what does "it is not allowed to update UI from a non-ui thread" mean?

This works: private class MyAsyncTask extends AsyncTask<....>{ protected void onPostExecute(){ // img is an ImageView img.setImageBitmap(bitmap); } } Sorry guys, I think my question should be more accurate if I ask " why…
nomnom
  • 1,560
  • 5
  • 17
  • 31
-1
votes
1 answer

Deployment.Current.Dispatcher.BeginInvoke Wont do anything

I am having trouble displaying html onto a web browser. I am using the method "Deployment.Current.Dispatcher.BeginInvoke" but it wont displaying anything. What I am trying to do is getting html from a server as a string and displaying in my web…
-1
votes
2 answers

AsyncTask cannot modify UIThread after changing from portrait to landscape

In my application I start an AsyncTask to download some data, and on the UI thread I start a ProgressDialog. The problem is when I change from portrait to landscape or vice versa, on the onPostExecute of the task I cannot dismiss the ProgressDialog.…
overbet13
  • 1,654
  • 1
  • 20
  • 36
-2
votes
1 answer

Update UI from another class in non-UI thread

I want to update the UI from another class in non-UI thread. But I can not call "BeginInvoke" in Test class directly. How to solve it... private void Form1_Load(object sender, EventArgs e) { Task.Run(() => { Test.Set(textBox1); …
ChiaHsien
  • 315
  • 1
  • 3
  • 10
-2
votes
1 answer

parameter in runOnUiThread

I have a timer in my android program: timer1= new Timer(); timer1.schedule(new TimerTask() { @Override public void run() { TimerMethod(); } }, 0, 3000); private void…
Mary
  • 41
  • 8
-2
votes
2 answers

From a API stand point, wait for a task -- but don't block UI

Running a longProcess() method in one of my C# api and while doing that we want to wait for that task to complete. But same time don't want to block the UI. I saw many SO threads, but nothing helps in my case. Below, Method 1 does not block UI and…
Sh Ale
  • 79
  • 1
  • 9
-2
votes
5 answers

C# While loop thread.sleep in GUI

I have a while loop inside a delegate method that is called. My issue is that while it is inside the while loop the whole GUI is frozen until it exits the while loop. How can I make it so it does not freeze the GUI? Thanks if…
user3774466
  • 23
  • 1
  • 4
-3
votes
1 answer

Stop, Kill or Cancel AsyncTask forcefully

I tried to stop AsyncTask on onPause() method. But its not stop at all. When my App navigate to other Activity AsyncTask still on work. this is my code... Motion1, Motion2 and Motion3 are ImageViews. class parseComments extends AsyncTask
1 2 3
39
40