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

How do I re- acquire focus in an edittext that is saving it's answer in the after changed event?

Here is part of the code: textField.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable editable) { timer.cancel(); timer = new Timer(); timer.schedule( …
1
vote
1 answer

How do i link my method to UI thread - .setBackgroundColor();

Please help me on how to link my method setter() to UI thread as every time I press changecolorbutton for grey, the instructionlayout.setBackgroundColor(); makes my app crash. what i have learned is i need to link it to a special thread so that it…
1
vote
0 answers

ImageView displaying lib improve performance

I'm using this lib to show photos (I dont want to use PhotoView lib, because it has no that I need). This lib is perfect, but have only one minus: when changing screen orientation it makes screen white and in a few mili seconds reloads image... I've…
1
vote
2 answers

Android ProgressDialog not working together with AsyncTask

I'm trying to run a function on another thread. Unfortunately it just keeps on going without dismissing. The Try catch works if i don't have it within the run function. I Thought it could be the AsyncTask that i have inside the function. i also…
1
vote
1 answer

Android - Looper.prepare() in a Thread vs Activity.runOnUIThread()

My question is quite simple but I'm not able to find a satisfying answer. The question is: Does my thread run on UI Thread if I call Looper.prepare() at the start of my Runnable? I know Looper is for MessageQueue and exchanging data between threads…
1
vote
3 answers

How to delay spawned thread when a Runnable run on UI thread isn't an option?

I had issues with a previous question where I was unsure whether my code had a memory leak. A few answers were concerned with it being run on the UI thread and so blocking. It is true, it runs on the UI thread and doesn't spawn a new one.. So to…
Alper Turan
  • 1,220
  • 11
  • 24
1
vote
2 answers

Only the original thread that created a view hierarchy can touch its views.

Main Activity Oncreate Method whenever i try to run this code it give me this error although i have added runonui Thread . but it is still not working any help will be appreciated . i have searched for this a lot but really didn't find anything …
Brendom
  • 123
  • 1
  • 10
1
vote
4 answers

Android runOnUiThread not updating UI elements

Hi I am developing android application in which I am using grid view. I want to updated grid item dynamically.My grid item contains one title text. I tried to do it like this but it is not working for me. ((Activity)context).runOnUiThread(new…
nilkash
  • 7,408
  • 32
  • 99
  • 176
1
vote
0 answers

android ui is not updating from ui Thread in api 10 after animation

i want to change image of ImageView inside of a DialogFragment every 1s ; the code is running ok in android 5 or 4 . but in android 2.3.7 (api 10) it changes ui for once and then doesnt change ui anymore .meanwhile thread is running okay so far , i…
ilaimihar
  • 141
  • 5
1
vote
1 answer

Get Latitude and Longitude from SQLite and place respective marker for every two minutes android

Friends, Am able to fetch the latitude and longitude from SqliteDb to place a marker in google Map respectively. But my problem is 1. I want to draw a route from current location to the latitude and longitude fetched from Sqlite Db 2. The db values…
1
vote
0 answers

Marquee on TextView, blinking textview and Seekbar progress thread block the UI

I have three animation working on my App. 1. TextView Marque (Scrolling continues) 2. Blinking Textview (When my Music app in pause mode) 3. SeekBar Progress thread (Shows the Progress of played song) While i use above all effect for my app, then UI…
0
votes
0 answers

Changing Button Color on MainActivity via RunOnUIThread Crashes

I am getting a kotlin.UninitializedPropertyAccessException: lateinit property BTNStatus05 has not been initialized When I try to set a ButtonColor. The idea is to change butttoncolor etc on a button, based on reply via a TCPsocket. In my My Main…
0
votes
0 answers

Capture Images and show in RecyclerView : Too much work on the main thread

I am trying to capture images in my Android App using camera and show it in a list using RecyclerView But because the images are quite heavy in size (6-7 MB each) and my list is can contains approx 8-9 images, I can see this in my logs:- 06-08…
0
votes
1 answer

Issue in rendering items in the main thread from a worker thread

I have created a counter app that counts from 0 to infinity until the loop is stopped using a stop button. The app contains 2 buttons(start and stop) and 1 textview. I aim to display the values from 0 to infinity(until the loop is stopped) in the…
0
votes
2 answers

runOnUIThread for Android is hiding the soft keyboard

In my android application, the core logic is written in C++. Hence for multiple scenarios, there will be JNI calls happening. In one use-case, as the text is being entered by the user in the 'EditText', I call a JNI method which will capitalize each…