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

My callback method is never called using an interface

I'm trying to implement a callback method to be called whenever a Thread is is done It's work. I'm using the interface approach and not the Handler approach. I have a main UI Thread which is the onCreate(Bundle) method and a Thread i call from…
God
  • 1,238
  • 2
  • 18
  • 45
0
votes
0 answers

C# UWP Assigned Access Dispatch from Thread to UI Thread

when I call this in a async task in my app in assigned access await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => OnFaceDetected(false)); I'm became this error : System.NullReferenceException: Object…
0
votes
4 answers

How to set text to a text view from a Thread class

I am reading a inputstream chunck by chunk and tryng to set read chunk to a textview from a Thread class but text is only getting printed after completion of while loop below is my code : class SendFileThread extends Thread { Handler…
Smart
  • 71
  • 1
  • 2
0
votes
1 answer

Changing UI from a background thread

I getting an error that Iam changing the autolayout engine from a background thread , is there's a way to know which block of code makes this warning ? or I just have to search for it by myself ?? Thank you.
user3703910
  • 624
  • 1
  • 5
  • 25
0
votes
1 answer

How to initialized GoogleApiClient inside a UI thread

I am calling : GoogleApiClient client = new GoogleApiClient.Builder(this.context) .addApi(Wearable.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); …
Saar peer
  • 817
  • 6
  • 21
0
votes
2 answers

System.Windows.Forms Timer is not functioning when a thread is running on main

I would like to ask anyone of you if you have tried this kind of scenario. I developed a windows application in c#. In main Program (Program.cs) I added a thread mutex just to multitask many operations executed under it. //under Program.cs public…
Juran
  • 177
  • 1
  • 8
0
votes
3 answers

Thread.Sleep(); sleeps all the program

I have a problem with the progress bars, I want to run two progress bar like I do in the following code: namespace probando { public partial class MainWindow : Window { int sec = 0; public MainWindow() { …
0
votes
2 answers

Using background worker and updating UI

When I need to perform an action that takes quite long, I call it in a BackgroundWorker like this, so it does not freeze the UI; BackgroundWorker bgWorker = new BackgroundWorker(); bgWorker.DoWork += (s, e) => { //Do something long lasting …
Revils
  • 1,478
  • 1
  • 14
  • 31
0
votes
1 answer

retrieve data without UI thread

I want to retrieve data from php file to my new android app. I tried to do it as background process there for I want to use it without UI thread. I couldn't remove UI thread from this code any one hep me to remove UI thread in this code do it? I try…
Kavindu
  • 11
  • 3
0
votes
3 answers

Wpf multithreading

UserControls.userGridGunler ug = new UserControls.userGridGunler();//My user control ug.Basliklar.ItemsSource = basliklar; ug.Saatler.ItemsSource = saha.Satirlar; TabItem ti = new…
CaKaL
  • 402
  • 1
  • 6
  • 16
0
votes
1 answer

Update a "checkBox" from a non-UI thread

I've recently coded a "battleship" program as a school project, and now decided to make a portable, mobile version of the program. By now, I'm also nearly done, the only problem I have left is that I want a checkBox (obviously on the UI thread) to…
PixelMaster
  • 895
  • 10
  • 28
0
votes
1 answer

Not able display GIF loader in WPF While Database operation executing

Hi I am trying to Display GIf Image on some Time Consuming operations execution. I tried with following code.. am able to see the load window but animation of gif image is not working.. when searched for solution I found Method to Update UI while…
0
votes
1 answer

update listview adapter inside run on ui thread method

I want to update listview adapter inside run on ui thread. Here is my code: @Override public void addItem(final String data) { runOnUiThread(new Runnable() { @Override public void run() { …
Eman Ahmed
  • 23
  • 1
  • 6
0
votes
1 answer

How long Android's application main thread can be busy without loosing performance

Android app must do something in UI thread a.k.a. main thread (at least update UI). How long Android's application can do something in UI thread without loosing performance (no UI jittering etc.)?
Marian Paździoch
  • 8,813
  • 10
  • 58
  • 103
0
votes
3 answers

How to make a periodic code run off the UI thread in Android

The following code is what I'm using currently, but there is an issue that the Toast is being shown, so it probably is in the UI thread isn't it? I do not want the run() function to run on the UI thread as I will probably add some heavy downloading…
A B
  • 189
  • 2
  • 9