Questions tagged [android-asynctask]
Use for questions on android.os.AsyncTask
14,562
questions
3
votes
1
answer
28
views
Layout render error when using Tasks modifying controls
Description
Hello,
Rendering of Layouts are not updated if they contains controls (ContentView) with some rendering Task !
I created a simple ContentView which contains three Image (the FireControl ...
1
vote
2
answers
34
views
How can I use findViewById method inside AsyncTask?
I have an AsyncTask to execute while trying to connect the phone to a Bluetooth device, I want to change an icon from a button if it connects successfully
(I'm new to Kotlin programming)
I would be ...
0
votes
0
answers
23
views
Android USB Issue - Device Won't Transfer Information
I have been trying to refactor this Android app's USB system. When the Android program is booted on the tablet, it works fine, but when there is a USB disruption/disconnection from the external device ...
0
votes
0
answers
21
views
UsbDeviceConnection.requestWait() Issue - External Device Won't Reconnect
Some background: I have been trying to refactor this Android app's Usb system. Initially, in order to transfer data between endpoints, they used the UsbDeviceConnection.bulkTransfer() method. I ...
0
votes
0
answers
31
views
How does AsyncTask<String, Void, AsyncGeocodingRequest.AsyncGeocodingSuccessful> works?
I've upgraded my target SDK from 22 to 32 and now I'm getting error in following code,
onPostExecute is not returning the list of address while same thing in older code is working absolutely fine.
...
0
votes
0
answers
35
views
Android ListViewItem update Progressbar in row
I'm using ListView with custom list rows,where every ListItem has ProgressBar in it.
When the user click the ImageView,the app starts an AsyncTask to download a file from a remote server,and update ...
0
votes
1
answer
39
views
Cannot get correct SharedPreferences value on onClick
I'm currently making a small app and I'm getting stuck on changing fragments using an onClick listener. I've searched the site and could find similar situations, but none of the proposed solutions ...
1
vote
0
answers
35
views
Device Connected To Android Tablet Via USB Becomes Disconnected and When Re-Connected Won't Resume Communication
I am dealing with an issue where a device called an aggregator board (AggBoard for short) becomes disconnected from an Android tablet, and upon re-connection it won't resume communication between ...
0
votes
1
answer
24
views
Populate ListView with ArrayList created in AsyncTask
I am trying to populate my listView with the "name" field of my ArrayList. The ArrayList is being created with JSON data. The listView is being populated when I add an object to the ...
0
votes
0
answers
34
views
Implement a buffer of barcode readings in Android
I'm developing an app that reads barcodes and for each barcode reading it executes a query.
I'm reading barcodes and executing queries correctly, but I need a buffer so if user scans barcodes very ...
0
votes
0
answers
12
views
AsyncTask onPostExecute blocks the UI for way too much time
So I have this COVID tracking fragment in my activity which uses data retrieved from an API and generates charts with that data. I am reading the data from the API asynchronously, and then using the ...
-1
votes
1
answer
26
views
AsyncTask/doInBackground not executing
I'm trying to create an app that queries a site of cat images, saves them to the android device if the JSON ID is unique, and then display them from the device in a slideshow format. Despite ...
0
votes
0
answers
27
views
Android(java) - Issue with Async task in for loop
Hi guys I am working on a web-scraping project in which I got 12 websites to fetch product details.
I have an.xml file which contains html details of that 12 websites like price class, pricetag, div, ...
0
votes
0
answers
30
views
ExecutorService async tasks with Handler and Message
In my legacy Android project i used RestTemplate by springframework as simple Rest client for http requests to my backend API.
(Just don't suggest switching to Retrofit, Volley, etc.)
Since AsyncTask ...
0
votes
0
answers
54
views
Android Java Correct way to call Threads
Problem
As a beginner in Android coming from Java and C# backends, I'm not sure how to avoid the warning that 'too much work is being done in the main Thread'. Since I'm already using ...
1
vote
0
answers
18
views
How update Progress Bar of dialog element in asyncTask?
I'm currently searching how to update my progress bar which is located in my dialog window.
I have already multiple post on this but I can't understand why my progress bar won't update.
Here is my ...
1
vote
1
answer
25
views
Runnable error After Asynchtask replacement
I am getting an error on the last line below after replacing my asynctask with a runnable to upload data to server: Any pointers will be appreciated.
Cannot return a value from a method with void ...
0
votes
1
answer
37
views
How to get string from a server in AsyncTask to a MainActivity?
I want to show a string that I get from a server which is placed in AsyncTask (or as I call it MessageSender class) on a MainActivity textView. I know that I need to use a setText() method. I am ...
0
votes
0
answers
36
views
Is there any way to wait for a task to complete and then resume the execution of my code? Android Studio Java
I'm doing a carpooling android app in which users can request and offer rides.
My problem is in searching the results for the rides as a passenger. My goal is to display all rides taking into ...
0
votes
0
answers
31
views
onPostExecute not called after completion AsyncTask. onPostExecute override right, not cancelled
Method doInBackground() works well, but never call onPostExecute(). Method onPostExecute() override right, I do not cancel the AsyncTask and start the task with execute() method. I can not understand ...
0
votes
0
answers
63
views
Async Tasks not found in Unity
I use system.threading.tasks library and this configuration:
Scripting Backend: IL2CPP
API compatibility level: .NET Standard 2.1
but the project throws these errors:
error CS1983: The return type of ...
0
votes
1
answer
107
views
Using coroutines in Kotlin to replace AsyncTask, Building a google maps Kotlin android app and I cant implement coroutines instead of AsyncTask
I have previously asked this question and on advice of a user I am posting again this time with my attempt at implementing Coroutines. I am trying to build an app to plot a route using google maps and ...
-2
votes
1
answer
40
views
Need an alternative for AsyncTask in Kotlin, I know to use Caroutines,Executors, Handlers but unsure how to implement in my google maps koltin app
I am building a google maps routing app and i cant build as AsyncTask is depreceiated, I know to use caroutines/executers/handlers but I dont know how to implement them in my code as I have followed ...
1
vote
0
answers
40
views
How to convert the Android Java code to equivalent C# Xamarin android code
Below given is my Android java code. I have an Interface PermissionResultCallback
public interface PermissionResultCallback {
/**
* Called with the permission result.
*
* @param ...
1
vote
1
answer
142
views
Using Coroutine for continuous data polling and dumping to UI
My existing Android code uses AsyncTask to continuously poll data from a virtual COM port and dumps data to UI thread by overriding the onProgressUpdate() function. Something like the following:
open ...
1
vote
2
answers
149
views
How do I use an Async Task listener to return and suspend from a coroutine?
What I'm trying to do is the following:
Load an Agent icon from an API
Using Palette, determine what is the vibrant swatch
Set this background RGB color and save it into the database
Database will be ...
0
votes
0
answers
35
views
How to use RecyclerView with Multi-Threading
I need to create an application that displays gallery photos in a RecyclerView, and
to retrieve the URI of the photo I use an AsyncTask.
The problem is that no photos are shown in the application, ...
-2
votes
1
answer
45
views
Thread freezes UI
I have this button that when clicked calls a thead to update user ui:
averageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
...
0
votes
1
answer
131
views
How do i make all build scripts to appear before plugins
That is my code, and when
try to sync, I get this error:
Gradle sync failed: Cause: startup failed:
build file 'C:\Users\user\AndroidStudioProjects\Chiro\build.gradle': 12: all buildscript {} ...
0
votes
0
answers
31
views
running onQueryTextSubmit in AsyncTask function
iam trying to fetch some json from an api, in java android, i have a onQueryTextSubmit listner to execute code when i press the submit button in my SearchView, but the problem is i cant execute the ...
1
vote
0
answers
180
views
PDF load error in com.github.barteksc.pdfviewer
I'm using com.github.barteksc.pdfviewer library to view pdf files. I don't know what happened it stopped working from past 2 weeks, Im getting PDF load error.
This is my
PdfViewer.java
class ...
0
votes
1
answer
45
views
publishProgress in Void cannot be applied to Strings in Asyntask?
I'm developing app to load pdf files in pdfView. I'm using Aynctask for this. I want to show the progress status in progress dialog.
Now the problem I'm facing is when I change AsyncTask<String, ...
0
votes
1
answer
117
views
want to create new thread in android studio kotlin for setOnItemClickListener on listview to open new activity by taking data from database
want to create new thread in android studio kotlin for setOnItemClickListener on listview to open a new activity by taking data from database .
i am doing this on main thread which making my app ...
0
votes
0
answers
24
views
Image not showing up in launch screen Android Studio
I have a project to do that involves downloading images from the internet with asyncTask with a progressbar at the bottom of the image and an infinite loop so it continues to through the images. When ...
0
votes
0
answers
13
views
Run SP in AyncTask to fill spinner
I need to populate a spinner using AsyncTask for better application performance.
Here is my code to catch data from SP:
public void fillSpinner ()
{
ResultSet rs = null;
...
1
vote
1
answer
85
views
Android Kotlin - clear glide cache in background thread doesn't work
GlobalScope.launch(Dispatchers.Default) {
Glide.with(this@UploadProfileImage).clearDiskCache()
}
I get unresolved reference on clearDiskCache
When I do
Glide.with(this).clearDiskCache()
instead ...
0
votes
1
answer
91
views
Good way to make Userdialog.Instance.Progress wait for method to execute C# Xamarin
I'm trying to show a progress dialog showing the percent done with the method to wait everything + an await Task.Delay(20); And an await for the method I want to execute. Now I notice that with that ...
0
votes
1
answer
35
views
How to change a variable of an AsyncTask in an activity from another activity by a button click in android studio?
I am using an AsyncTask in my MainActivity in Android Studio, where in doInBackground method, I have an URL, that I want to be changed from a list view item, which is loaded to a listView in ...
0
votes
0
answers
25
views
Which is the best way to Volley parsing another class in Android?
After parsing the json structure from the web with the help of the volley library, I save it to the Room database. I decided to perform this operation in another class other than MainActivity. But I ...
0
votes
1
answer
28
views
How to get value inside Thread
Context:
I have a thread, inside the thread what I do is check if a URL exists or not. and I need to retrieve the value of the "urlExist" variable to use outside the method.
Code
fun ...
0
votes
2
answers
2k
views
Unity C# - Execute async task within a Coroutine and wait for it to finish
I'm completely new to Unity development and I'm trying to integrate an asynchronous functionality into an existing Coroutine but I have faced several issues so far.
My issues:
The Unity app ...
2
votes
1
answer
239
views
Saving events in Prolific Material Calendar View
I'm using material calendar view in my android app from here :
https://github.com/prolificinteractive/material-calendarview
I have implemented Dotspan decorators on button click. But how do I ...
0
votes
1
answer
15
views
android - unable to post large data via Uri.Builder
I post my data via Uri.Builder to the server . I've a very large data in my variable , this is the data :
630#738#6589#7772#7771#7769#7768#7767#7766#7765#7764#7763#7762#7761#7760#7759#7758#7757#7756#...
0
votes
0
answers
31
views
how to implement progress bar in AsyncTAsk
I am new in Programming, what I am trying to do is load pdf in my app for that I am using async task to do the loading part in the background. and when the pdf is loading in the background i want to ...
2
votes
1
answer
422
views
Is a work manager good for these situations?
I'm developing some features that need to run in the background with a UI update like creating a file from the input stream and notifying the user after it's finished
After trying the work manager for ...
-1
votes
1
answer
47
views
Android interstitial ad seems to block AsyncTask
I have two activities (Activity A and B) and when user moves from the Activity A to Activity B my app displays Intersitial Ad. In the Activity B app has AsyncTask which gets data from database using ...
0
votes
1
answer
40
views
Retrieving value from awaited task on Kotlin
C#/Java Dev trying to learn Kotlin here.
I'm pinging a website from my Kotlin app, but I'm unable to fetch the awaited Task result.
'pingResponse' (inside the awaited function) returns true as ...
1
vote
1
answer
89
views
(AsyncTask) Open a dialog when catch (Jsoup)
I want the dialog to open when "AsyncTask" is "catch". I tried to call Dialogue into a “catch”. But the program is crashing. How do I open a dialog when there is a catch?
My code:
...
-1
votes
1
answer
60
views
when the device internet does not work (or is turned off) exits the program. (Jsoup) [duplicate]
JSOUP
when the device internet does not work (or is turned off) exits the program.
but it works without problems (without app crash) while the internet is running.
if the program enters this coded ...
0
votes
1
answer
64
views
asynctask errors after android studio update
app have no error but asyntask.java has errors, abouth annotations, what can i do?
import android.annotation.MainThread;
import android.annotation.Nullable;
import android.annotation.WorkerThread;
...