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

Getting Execute before finishing the task Android

Hi I'm running the Asynctask in my activity and getting the data from the server. In onPostExecute metod I'm inserting the data in Database now I want to pass those ids in two different fragments I'm passing the the ids by following code: Bundle…
user3154663
  • 291
  • 1
  • 2
  • 18
0
votes
0 answers

IsolatedStorageSettings freeze UI thread WP8

in my app when a user logs in to skydrive and the status changes I am changing 4 settings in IsolatedStorageSettings. It is done the same as http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769510(v=vs.105).aspx When I modify these 4…
0
votes
3 answers

Thread is stopping until the execution of a method is complete. (Android)

I'm trying to do an Android game using a Thread which repeats a loop for draw, move and others. I have a problem with the execution of a method, which searches a value with a "do while" loop. When this method is executed, the thread does not…
karse23
  • 4,055
  • 6
  • 29
  • 33
0
votes
1 answer

Synchronise access to a resource from the UI thread

I lock on a global object in order to synchronise communication to an external device from various threads, which is working fine. I want to user a slider control to set values which I then send to my external device, so I'm using its Scroll event…
digital_fate
  • 567
  • 1
  • 5
  • 15
0
votes
0 answers

Reporting progress of an operation

How can I report progress of an operation to the UI, ..whilst in that operation? i.e, I want to do something like : void DoExpensiveOperation() { var dlg = new ShowProgressDialog(); dlg.ShowDialog(); dlg.Status = "StepOne"; …
pastillman
  • 1,104
  • 2
  • 16
  • 27
0
votes
1 answer

Timer textview display not always showing decreasing values, not synchronized

So I'm trying to create a simple timer app that outputs the elapsed time to the screen. I'm trying to incorporate a pause button. It seems to work, except when pause button is pressed closed to values of x:x:1~ (min:sec:milli) if you unpause and…
ABC
  • 1,387
  • 3
  • 17
  • 28
0
votes
2 answers

Changing the UI from a singleton handler class

I have the below singleton handler class public class MyHandler { private static Handler handler; private static boolean isRunning; public static Handler getHandler(Runnable myRunnable) { if (handler == null) { …
tony9099
  • 4,567
  • 9
  • 44
  • 73
0
votes
3 answers

Dismissing ProgessDialog on Android

I've been to get rid of a ProgressDialog for some time now. After some googling and reading through questions on stackoverflow I round that I can only run ProgressDialog.dismiss() from the UI Thread. After some more reading I learned I need to…
Ron
  • 1,989
  • 2
  • 17
  • 33
0
votes
1 answer

Trying to establish best practices for SharedPreferences

I am trying to work out the best practice for accessing SharedPreferences. Should they ALWAYS be accessed through the PreferenceManager? And can they ONLY be read and written to via the UI thread? Any pointers or links to where I can read about this…
helper
  • 15
  • 5
0
votes
1 answer

Having trouble with Asynctask in android

I'm developing some sort of game for android, in order of fulfilling this purpose I'm using a SurfaceView which is hold inside an Activity. There are sometimes when a pause is required so the Surfaceview actually draws something in the canvas, then…
Luis
  • 25
  • 1
  • 2
  • 8
0
votes
2 answers

Multrithreading UI Update android

I've got a strange issue with my code which haven't been able to resolve during the last couple of days. Let me put it this way: I have an array of two threads which retrieve images from 2 separate streams and I am updating two imageviews on my…
Mr.Noob
  • 1,005
  • 3
  • 24
  • 58
0
votes
2 answers

Android Threads, Handlers, handleMessage: Updating UI thread from runnable threads within external class files

Background: I am trying to convert a Java (Non GUI) program to run on Android. For simplicity lets say this program has the following files: DSGen.java, SInfer.java, Main.java In the Main() method, objects for each of the classes DSGen and SInfer…
iron3rd
  • 49
  • 2
  • 6
0
votes
6 answers

UI thread waits for Async result and act according to result

In my android project I am trying to call a web service which returns a string result. After execution, result will updated in UI thread using onPostExecution() and the result will decide whether to move to next activity or to notify user to correct…
user2376920
  • 242
  • 1
  • 7
  • 19
0
votes
1 answer

Transfer data from background to UI thread

I have a quite long list of items (about 100) , which I am getting from server and that I show to an user in a LongListSelector. Every item is a picture, name and some description. The main problem is that when I am sending the list to…
Vitalii Vasylenko
  • 4,776
  • 5
  • 40
  • 64
0
votes
1 answer

Return Background Task Result To UI Thread defined in different different java files

Hi I have created a sample android project to learn how android can access the network task in background thread and how it will update UI thread. I have successfully done it in MainActivity.java here is my code for MainActivity.java package…