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

Issue calling something on the UI Thread from inside a callback in c++/cx

This is my Callback function: void VideoCapturerSampleCallback(struct LmiVideoCapturer_* capturer, const LmiVideoFrame* videoFrame, LmiVoidPtr userData) { //TODO will have to be on ui thread; …
rosu alin
  • 5,674
  • 11
  • 69
  • 150
0
votes
1 answer

Android UI Thread Rendering Worker Thread

Android uses MessageQueue (pipeline thread pattern) to process UI events (such as button clicks, mouse movement, orientation changes, screen redraw and so on). This allows you to change a button caption without having to worry that the user…
Amit Yadav
  • 32,664
  • 6
  • 42
  • 57
0
votes
1 answer

OnGlobalLayoutListener fires all the time if SoftKeyboard is visible

what i'm trying to do sounds really simple. Resize my GridView when SoftKeyboard is open. Put it back on place(resize height) where it belongs if SoftKeyboard dissapears. For this i did…
MMike
  • 598
  • 3
  • 23
0
votes
0 answers

Runnable thread stuck/freezes the ui after continuously loading webview

Due to loading webview coninuously using my runnable thread in android , my application freezes after some time. below is my code: mUpdateTimeTask = new Runnable() { public void run() { System.gc(); …
MST
  • 113
  • 1
  • 8
0
votes
1 answer

Unable to update seekbar with Handler

I am trying to update seekbar with respect to the progress of the song in MediaPlayer. I am using Thread to do that task. First i have used Thred inside thread and trying to update the UI but it crashing the app and says that only original thread…
Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188
0
votes
1 answer

How to get values from UI Thread in a worker thread in Windows Phone?

I would like to call a RESTfull service using the POST Method in my windows phone 8 app. So I need to insert the datas that I want to send in the body of the request after parsing it to JSON. To do so, I've used the following code: enter cprivate…
Hubert Solecki
  • 2,611
  • 5
  • 31
  • 63
0
votes
1 answer

How to use wait() and notify() in Android

I am trying to open a AlertDialog. When this AlertDialog is opened, the threads need to wait for user input in order to continue its program. I read that I need to lock the object thats need to wait and notified. When I run this code on my phone.…
0
votes
0 answers

Android - Unable to modify class variable using AsyncTask

assume that I have main class A that extends Activity and second, inner class B that extends AsyncTask. What I want to do is to edit instance variable of class A using asyncTask. However, still can't figure out why it does not works. As method get()…
jpact
  • 1,042
  • 10
  • 23
0
votes
1 answer

It's a good practice to call File methods within JFrame class?

It's a good practice to call File methods(like read a text file) within JFrame class or what should I do if not? Thanks for reply. This is my code: private void filechooserButtonActionPerformed(java.awt.event.ActionEvent evt) { …
enkeyz
  • 43
  • 1
  • 7
0
votes
1 answer

How to not block the UI while doing time consuming work which DOES Involve accessing UI Controls?

I have a method which is a time consuming one and therefore I have been trying to implement a BackgroundWorker, but it does not allow accessing UI controls which I have read and tried (hacking it) but to no avail. What my method does: Creates a new…
user1705923
0
votes
0 answers

Synchronize UI thread (Pivot item from active to non active view)

I would like to synchronize the UI thread with changes in a view (pivot item 1 active view) which is active when the changes begin and switch to non active state (User interaction like changing the pivot item from the pivot item 1 to pivot item 2)…
0
votes
2 answers

UI thread runs before async class runs in android

I am doing a validation for fields in an android form.I am checking with server whether the username is available in the server or not.But the main thread goes to the next page before the async checking completes. The…
Achuthan M
  • 349
  • 1
  • 4
  • 17
0
votes
1 answer

2 C# Background workers, locking UI and crashing (1 background worker is fine)

I am trying to use 2 background workers in WPF however the "spinner" seems to lock the UI thread which stops the progress bar from moving along. It also seems to cause occasional crashes with my parrallel for loops in the "load data" function I…
chrispepper1989
  • 2,100
  • 2
  • 23
  • 48
0
votes
0 answers

Java : Running a UI thread and worker thread asynchronously while letting the worker thread give feedback to UI thread

I have two threads a and b. a is a UI thread and b is a non UI thread. My code looks something like this : start a : int i; start b (asynchronously){ populateInt(i); } //back to a if (i = something){ doSomething(); …
0
votes
1 answer

await of async WCF call not returning to UI thread and/or blocking UI thread

I have upgraded a .NET 4.0 WinForms program to .NET 4.5.1 in the hope of using the new await on async WCF calls in order to prevent freezing the UI while waiting for data (the original was quickly written so I was hoping the old synchronous WCF…
Allan K.
  • 49
  • 8