Questions tagged [android-thread]

147 questions
3
votes
0 answers

How to add static data and then in real-time in GraphView in Android?

I need to add data from a array and then add data in real time. I can do the 2 things separately, but when I want to do everything together, the application closes before it starts. The idea is to show data that I receive through Bluetooth and as I…
3
votes
5 answers

Systrace by Command Line error

i am trying to use of systrace. for this, i am reading official site. but after run this command on terminal : D:\Software\Android\android-sdk\platform-tools\systrace>python systrace.py --time=10 -o mynewtrace.html sched gfx view wm I got these…
sayres kabir
  • 362
  • 4
  • 22
2
votes
1 answer

Does handler belong to thread in which it was created?

I'm relatively new to the "Looper-Handler" term. I'm pretty clear with the way they work but still confused with their architecture. I've also gone through couple of SO questions, but still I have some questions regarding them. To get them clear and…
2
votes
0 answers

Thread conflict Observer pattern for notification management

I'm developing an android application that have to receive some notification. I receive this notification between firebase and I had create a dispatcher object for update some information in some Fragment or Activity. I'm trying to use Observer…
2
votes
1 answer

Toast is being displayed from a handler which is attached with a background thread. Not sure how that can happen?

I used HandlerThread and then used its looper to create a new Handler so that it can run operations on a non-UI thread. In the runnable which is posted to the handler, I added Toast messages to be displayed. I expected that to cause a problem as you…
Richa
  • 700
  • 8
  • 12
2
votes
3 answers

Refreshing RecyclerView from another thread causing error

I have arraylist of items which has been updated in another activity, as I return from activity, I want to refresh my recyclerview with completely new ArrayList(). To avoid lagging I place this refresh to other Runnable Thread and I put ProgressBar…
martin1337
  • 2,384
  • 6
  • 38
  • 85
2
votes
1 answer

How to stop all services, threads, unload libraries on android app kill

I want to give user ability to choose language of application UI and content in it with different languages. I want to reload new fresh localized data from server with new language which user select. To do application recreation with new language…
yozhik
  • 4,644
  • 14
  • 65
  • 98
2
votes
0 answers

How to use MFCC TarsosDSP with microphone in android

in this example (answer): How to get MFCC with TarsosDSP? they show how to use MFCC in android @Test from float array, Im trying to use it with data from microphone : int sampleRate = 44100; int bufferSize = 8192; int bufferOverlap =…
2
votes
0 answers

Running Android Room queries on SyncAdapter

Android Room queries can't be executed on the main thread, then normally I use Handler or AsyncTask from an Activity. However, when in need to persist data in a SyncAdapter, what is the correct way to execute Room queries in a different thread? (I…
juliano.net
  • 7,982
  • 13
  • 70
  • 164
2
votes
1 answer

How to find calling thread stack trace from breakpoint?

I have a Thread in my Android code and while debugging, I need to set a breakpoint inside the thread. However, once I am at the breakpoint inside the thread, I can't see the stacktrace of the calling thread. At this point, I usually need to set a…
1
vote
1 answer

Kotlin - delay between UI updates

I have created a simple tik-tac-toe game and have some bots you can play with. I am trying to have a delay between consecutive bot turns as otherwise all sequential bot moves appear on the screen at the same time here is what I have tried in my…
1
vote
1 answer

How to resolve ANR problem occured in SensorEventListener operating separete thread?

I'm noob at Java Android Programming(actually I'm noob at overall computer programming). I intended to make SensorEventListener of Accelometer sensor in a thread separate from main thread at Service. onSencorChanged method works well in separate…
1
vote
2 answers

Android Kotlin change ImageView image source in RecyclerView

I am struggling with a problem. I have an activity that has a RecyclerView with images. The RecyclerView is filled throught adapter, and that's works fine, and I got his starting screen. After this I want to change this images in a loop with a…
Wasyster
  • 2,279
  • 4
  • 26
  • 58
1
vote
0 answers

AsyncTask to update ui counter which is invoked in other class in android

I need to update file upload count dynamically into Ui progressbar which is invoked in other class method. How can communicate between AsyncTask doInBackground() and myClass.uploadFiles(). please help me this is activity public class MyActivity…
1
vote
1 answer

WorkManager or Foreground Service?

Once the user gets into an activity, I need to send a value to the Web Service and, once s/he exits the activity, I need to send another value to the server. It needs to happen at that exactly moment. Android Developers guide says I should use…
1
2
3
9 10