Questions tagged [android-runonuithread]

This is a way to run the specified action on the UI thread of Android framework.

runOnUIThread is a method of an Android's Activity:
It runs the specified action on the UI thread. If the current thread is the UI thread, then the action is executed immediately. If the current thread is not the UI thread, the action is posted to the event queue of the UI thread.

Useful links

187 questions
1
vote
2 answers

Setting textview visibility inside retrofit on failure callback

I am trying to set the visibility of a Textview depending on the response returned by Retrofit . onFailure, I am setting the visibility to visible tv_no_cat.setVisibility(View.VISIBLE); However, this does not work. I am doing the same with a…
1
vote
0 answers

Textview and ImageButton VISIBLE State and RunOnUIThread

Background I am calling okhttp newcall(request).enqueue(...) method and if it fails then I renspond back to main activity using a Listener, Where I show textbox and image button to ask user to reload. I am changing view states using…
omer
  • 522
  • 1
  • 8
  • 26
1
vote
2 answers

How to pop up dialog activity when app closed

I try to make sample application that show contact name and number from my local contacts when incoming call, every thing work correctly but my activity dialog didn't appear till call finished or terminated. I want to show this dialog like…
Azak
  • 270
  • 1
  • 5
  • 15
1
vote
0 answers

button color changed but not updated in screen in android

See I have used runOnUIThread(){} in AsyncTask to update button color. After updating those button attributes I can read its color, name, etc... In Log everything is showing correctly but those properties were not getting updated in UI. How to fix…
1
vote
1 answer

Android: 'threadid=3: reacting to signal 3' when executing long task

I am executing a command with Runtime.getRuntime().exec(cmd) inside my app. As it takes long to finish execution(several minutes), I have put it inside a thread. but with thread approach also app is getting suspended halfway and I see this…
1
vote
0 answers

How can I set Main Page (or wait for MainThread) if app is closed during the startup process?

When my app is launched, a splash screen is set which is just an ActivityIndicator. Then, a task is run that starts up services and looks for saved passwords. This task is run async so the ActivityIndicator can spin. This works ok unless the home…
1
vote
1 answer

Android how to finish activity from other process

There are different app just call A and B, I need to finish the activity in A when get the provider call from B, I found sometimes will fail, the activity no finish if do finish directly. PS: the call thread is from B Main UI Thread, and I try to…
cici
  • 13
  • 3
1
vote
1 answer

runOnUiThread not working properly

I am trying to create textview in android which display the remaining time(seconds). Have used runOnUiThread and Hadnler for this and everything seems working fine(sysout and debug shows that both threads are executed and value is updated…
Chota Bheem
  • 1,106
  • 1
  • 13
  • 31
1
vote
3 answers

Android: Best practice to ensure that a UI operation is done on UI thread

I have landed into situations where I need to do some the same UI operation (let's say showing of a Toast message) from two different threads. The difference is that the first thread is the UI thread for the activity and the other one is a separate…
Swapnil
  • 1,870
  • 2
  • 23
  • 48
1
vote
1 answer

Close runOnUiThread

I have an AsyncTask running and in this thread I start a runOnUiThread to manipulate my views. If I close my AsyncTask, the runOnUiThread runs still 1 time longer after I closed my AsyncTask. How can I close the runOnUiThread?…
user6723683
1
vote
0 answers

How can i stop multiple create runOnUiThread() when activity finish()

runOnUiThread(new Runnable() { @Override public void run() { channelAdapter.notifyDataSetChanged(); stopActivityIndicator(); setChannel(0); } }); i have added this code in my activity and when back press finish activity then my…
Gaurav Mandlik
  • 525
  • 1
  • 9
  • 42
1
vote
1 answer

Socket IO runOnUiThread doesn't work

I have trouble with runOnUiThread in socket io. I use this library. I have listener for some event. If I get this event I change the image. But when I get event image stay as before and I don't understand why it's happen. Maybe someone help or…
Alex Khotiun
  • 431
  • 4
  • 16
1
vote
2 answers

TextView setText not working inside ScheduledExecutorService runOnUiThread

Code : private void startTimer() { final ScheduledExecutorService scheduleTaskExecutor = Executors.newScheduledThreadPool(1); scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { …
Logic
  • 2,230
  • 2
  • 24
  • 41
1
vote
3 answers

Global Variable Not Being Set Correctly in OnCreate

I am trying to pull contacts from the phone of the user and then match these against the phone numbers I have in my parse backend and then display the matches in a custom list view. I have managed to do almost everything, however I am having trouble…
Riley MacDonald
  • 453
  • 1
  • 4
  • 15
1
vote
1 answer

setActionView(null) giving me this warning: The application may be doing too much work on its main thread

I am attempting to create a progress bar spinner in my actionbar and getting an error when removing the spinner: Here is my code public void setRefreshActionButtonState(final RefreshState state) { //new ActionButtonState(state).execute(); …
slackwars
  • 504
  • 5
  • 18