Questions tagged [android-thread]
147 questions
0
votes
4 answers
Error when refreshing UI on Thread and changing Fragment
So I have a problem of understanding (i think) of how refreshing UI works.
I have an activity with a bottom navigation bar with 3 items that load a fragment.
Each fragment load data from internet so I download these data into a thread and when it's…
user10218123
0
votes
1 answer
What is the better way to instantiate a ProgressDialog class and why?
Here is an example of creating the progress dialog:
First situation:
private ProgressDialog progressDialog;
btnCircle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
…

Dezo
- 835
- 9
- 16
0
votes
3 answers
Fragment: The application may be doing too much work on its main thread
I am using 3th fragment in my app. When i come to 3.fragment i want to send message other devices with bluetooth. But my log said :
The application may be doing too much work on its main thread.
And than my AcceptedThread lock. So my ConnectedThread…

CKocar
- 566
- 9
- 25
0
votes
1 answer
Android Workers thread
I'm using WorkManager in my application, is there any chance to force using same thread on each Worker instance? I'm doing operations from those Worker on my list and I need to be sure that they will be in a proper order. I know that there is…

falsetto
- 789
- 2
- 11
- 35
0
votes
0 answers
Realm performance effect on my app when using executetransactionasync instead of executetransaction?
I am trying to insert an element whenever I receive a push notif in FcmListener class using Realm now I thought that as I cannot use executetransactionasync in this class because this class does not have a looper, that's why I thought using…

Sudhanshu Gaur
- 7,486
- 9
- 47
- 94
0
votes
3 answers
How to run code every 60sec in Android
In my application I want run code every 60sec and this my code for get data from server.
For this I write below codes.
But after 60sec when run code, show me ForceClose error and show below message in logCat.
Show me error for my views into my…

BoboGoooool
- 79
- 1
- 1
- 6
0
votes
1 answer
Async Task for backgroundResource
I have an imageButton that changes based on some variables, and I would like to let this process happen in the background.
I've tried putting it in a thread, but I don't understand AsyncTask that well quite yet.
public void initGameButtonOne() {
…

kveola92
- 69
- 4
0
votes
2 answers
Cannot update MainActivity textview from another class
In MainActivity:
private TextView log;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
log= (TextView) findViewById(R.id.log);
}
public…

Alvin
- 8,219
- 25
- 96
- 177
0
votes
0 answers
Service timer delayed
I am creating an application which will check status of the villages in one game and i have a problem.
I have background service which have set time 60s and it's repeat.
Everything looks fine but after some time (10-30 minutes) when i give…

Erik Juríček
- 75
- 1
- 9
0
votes
1 answer
Android Updating Text_Widget from another Thread
I have little loading screen which has TextField, when loading screen is created it launches new Thread. That thread has 3 things to do, 1) Create new object to scanning class and run it's scanning method 2)in scanning method were it gets tricky it…

Gerard
- 13
- 4
0
votes
1 answer
When is the best time to kill a Thread and How?
I have an activity which has a class which extends SurfaceView and implements Runnable to constantly draw on a Canvas object. I realized when I want to switch activity and kill the current one, the Thread will not be destroyed by itself even if I…

TheEngineer
- 792
- 6
- 18
0
votes
1 answer
Two action at the same time, android
I have a doubt, is it possible to have two independent actions at same time in a single thread?
For example, when you build a custom view you have to override onTouchEvent()
function that is called every time you touch the screen and also while you…

Andrea
- 429
- 6
- 14
0
votes
1 answer
Mediafile and SeekBar are not playing
I have a SeekBar and some MediaFiles fetched from sd card. Below is the code I wrote to play MediaFile and to progress SeekBar according to MediaFile position, but when I click on the item in the ListView, it does nothing and nothing starts. I don't…

devesh kumawat
- 61
- 9
0
votes
0 answers
Handler in onresume causes sigbart error
I am using a handler onresume method which causes a sigbart error asking not to block ui threads. Here's the code I have:
@Override
public void onResume(){
super.onResume();
new Handler().postDelayed(() -> {
try…
user2386226
0
votes
1 answer
Progress bar reset when button is re-clicked
This Code means that if I Click a button, a progress bar start 0 to 100%. And I want to make the progress bar reset, when I click a button before the progress bar reaches 100%.
Here is a part of my code.
This code is button listener.
public void…

오영택
- 25
- 2
- 8