14,471 questions
1
vote
0
answers
56
views
How to add cards to a fragment on network response in Android
I am new to Android and looking for some help. I am making a get request which returns a list as a string. For each entry in this list I want to add a card to a linearLayout in a horizontal scrollview ...
0
votes
1
answer
40
views
How to associate Fragment with no UI to the MainActivity
I have MainActivity.java that implements an interface from SshFragment.java which runs an AsyncTask in the fragment. The fragment has no UI but I'm unsure how to define it so and I'm confused how to ...
0
votes
1
answer
49
views
android.os.NetworkOnMainThreadException even using an Aysnc task
I am trying to call a SOAP service with Android studio, but I am getting the following exception android.os.NetworkOnMainThreadException
I know should be when running a network call on the main thread,...
0
votes
0
answers
37
views
Java Android how to make two parallel progress bars in recyclerview
I am making a game that has a recyclerview with several items, each item has its own progressbar filling time, I need them to fill in parallel and start over after completion.
I did it with asynctask. ...
-2
votes
2
answers
127
views
How to wait for async task to finish getting data from database before loading maps without sleep?
So my object is simple and need to know if I can either make my code better all the way around or remove sleep from my code and somehow wait for the async task to finish with getting data from a ...
1
vote
0
answers
186
views
How to overcome ANRs issue even though i run the background task in GlobalScope.launch(Dispatchers.Main)
The app is prompted with an "App is not responding" window.
In my main activity, inside the button click, I am calling "Background task" Meanwhile I am shown a progress bar in the ...
0
votes
1
answer
96
views
Writing Values to Google Sheet - Coroutines and NetworkOnMainThreadException Issue
I'm attempting to write data from a list to a specific Google Sheet. I've set up the configuration, but I'm encountering an error that seems related to not using a coroutine.
Is my approach correct? ...
0
votes
1
answer
49
views
Change value in a TextView after requests to firebase - Java Android studio
I make two requests to the Firebase database, and then load the data into the XML. But it doesn't load them and just leaves the default, I suspect it's because I'm not handling asynchronous requests ...
0
votes
1
answer
60
views
Change TextView in the xml file after two asynchronous requests - Java Android studio
I make two requests to the Firebase database, and then load the data into the XML. But it doesn't load them and just leaves the default, I suspect it's because I'm not handling asynchronous requests ...
0
votes
0
answers
50
views
ANR Genrated : Local Database data load is not working properly in android
I have one query regarding the local database.
As my system works, when the user logs in for the first time in the application that time in the dashboard we get an API call for getting data. But in ...
0
votes
1
answer
378
views
AsyncTask onBackground() throws error - Caused by: java.lang.IllegalStateException: Method addObserver must be called on the main thread
Today I opened my project which haven't been updated for about 6 months now and I decided to update all the libraries to make it up to date with recent Android development environment.
After updating ...
0
votes
0
answers
127
views
Passing or declaring variable of AsyncExecutorService in right way
Since Android 11 AsyncTask is deprecated so I implemented in a separate .java file this AsyncExecutorService abstract class:
public abstract class AsyncTaskExecutorService<Params, Progress, Result&...
0
votes
1
answer
103
views
Why is my JSON Volley request causing ANR if it is Asynchronous in itself and the data transfer into my database is handled within an AsyncTask?(JAVA)
Just an FYI, this is my first time working with JSON, Volley, or ASyncTask.
For a coding challenge I have to download a JSON array from a url into an android application and display the list of items ...
0
votes
1
answer
100
views
AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
I am making an app for showing nearby places. But I have a runtime error FATAL EXCEPTION: AsyncTask #2NullPointerException and the app is crashed.
I am trying to send nearby places data URL. But I ...
-1
votes
1
answer
703
views
Hi; how can i interrupt an async function during its allotted runtime?
We are coding behaviors for a robot in python async; we would like the robot to have multiple states, within each of which it will exhibit multiple behaviors, some random, some in order. These ...
0
votes
1
answer
605
views
Android inter thread communication best practices with ViewModel and CameraX?
I have the following scenario (view code below):
Get an ImageProxy from the loop of the ImageAnalyzer use case of CameraX
Analyze the image (takes about 20 ms) and return some information, close() ...
1
vote
0
answers
61
views
Android AsyncTasks Not Running in Google Play Deployment but working normal when launched to device from Android Studio
I have been developing Android for 13 years and today I discovered the first issue I am completely not able to understand or even begin to debug.
My app which makes a number of web calls to fetch data ...
0
votes
2
answers
251
views
How to make asynchronous tasks and return value only when value is available? (the response is not empty)?
I have a function which returns a List of Strings. This function requesting a response from the server. But firstly the function returns null, then a bit later returns a response with String. How to ...
0
votes
0
answers
32
views
What is the order between AsyncTask and normal code?
I added AsyncTask class file to receive Json file from API server.
At that moment, I has wondered about sequence between code of calling AsyncTask and normal code at under the code.
I has known that ...
1
vote
0
answers
57
views
Convert AsyncTask to RxJava in Android studio java
First, I'm brand new to java on android studio, and trying to use codes from github using asyncTask. However AsyncTask is deprecated so it needs to be replaced with rxJava according to what I was ...
0
votes
1
answer
72
views
App is crashing after mail sent successfully using Asynctask
Mail is successfully sending without Asynctask. But I need to show a progress dialog while sending the mail, so I implemented Asynctask to send the mail and while sending show the progress dialog. But ...
1
vote
1
answer
66
views
For loop inside a class that extends the AsyncTask<Void,Void,Void> doesn't work
In my project, I am trying to scraped data. I have prepopulated sqlite database in my asset folder. The adapter class MySqliteAdapter.java fetch the sqlite database which contains a list of artitle ...
0
votes
1
answer
111
views
How can I convert an AsyncTask to a Runnable?
I want to set bitmap for ImageView. I have the URL from Firebase stroage, I use the BitmapFactory to turn to picture, I need to apply it on ImageView, I can do it with AsyncTask but I don't know how ...
0
votes
1
answer
145
views
How I can parse JSON data only once when my application is running
I've no idea on how to parse JSON data only once when my application is running. Currently JSON parsing is done on every user interaction like landscape/portrait orientations, page refreshing and page ...
0
votes
1
answer
33
views
How do I get the Value out of my Class into my TextViewField
At the moment I am trying to make an Android App with Android Studio with GET and POST data into/from an API.
My problem at the moment is that I want to have the response of the POST request displayed ...
0
votes
1
answer
94
views
Xamarin Android dialog.PositiveButtonClicked not working
I would like to have some code run (use Intent to go to new Activity) when the user clicks the Ok button in a dialog (DialogFragment)
I see in the debugger it hits the line of code for .Show.
But it ...
0
votes
1
answer
372
views
Async Task Replacement [duplicate]
What is the replacement of async task as it is deprecated and how to use the replacement ? any suggestions.
Replacement that functions same as async task.
1
vote
2
answers
775
views
How can I resolve Task is not yet complete exception when implementing Google Cast into project?
I've been working on this for weeks no joke but I'm really stumped at this one part. So I'm in the process of implementing Google Cast into a poorly constructed codebase that I inherited.
Specifically,...
0
votes
2
answers
66
views
How to use AsynsTask in JAVA (Android Studio)
I have the following code:
int my_couter = 0;
if (SDK_INT >= Build.VERSION_CODES.R && Environment.isExternalStorageManager()) {
my_couter += 1;
}
if (ContextCompat....
0
votes
2
answers
101
views
AsyncTask does not updating my textview in resume fragment after destroy
I am running a thread in background contains timer and I display this timer in TextView but when I change current fragment and I return the timer still running in logcat but does not update in UI
My ...
0
votes
1
answer
61
views
SQL Server and Async class error android.os.NetworkOnMainThreadException
I'm developing an app with Android Studio, java. I perform some operations that require an Async class. After I started using such classes, other activities are no longer able to connect to Sql Server,...
0
votes
1
answer
23
views
Asynctask does not return string, but does not contain a reported error
I'm passing a URL to an ASYNC class (wsbRedirTest) and I expect to receive the content of the page. However, it does not return any results.
public class wsbRedirTest extends AsyncTask<String, Void,...
0
votes
1
answer
269
views
How can I change AsyncTask (deperecated) to Coroutines in kotlin?
I am migrating code from AsyncTask to Coroutines because AsyncTask is deprecated. How can I implement the change from AsyncTask to Coroutines in the BookRepository.kt. How can I restructure the code?
...
1
vote
1
answer
84
views
Using Android futures to move heavy computation to background thread
I have a function that runs on the Android main thread (UI thread):
fun someFunc() {
...
doSomething1()
doSomething2()
doSomething3()
...
}
doSomething2 is a heavy computation that causes ...
0
votes
0
answers
57
views
My app keeps crashing on when I'm using AsyncTask
I'm developing an app which downloads any image or pdf file in internal storage using a url. For this I'm using the AsyncTask class. The problem occurs as soon as I click the download button. My app ...
0
votes
3
answers
5k
views
Parameter specified as non-null is null : kotlin.jvm.internal.Intrinsics.checkNotNullParameter
I'm trying to upload image to website, It was successful but app shows FETAL error.
issue seems like in AsyncTask as it might get executed to early.
I also upgraded SDK version 30 to 32
& ucrop:2....
0
votes
0
answers
34
views
Is the AsyncTask most productive technique for slow background tasks?
There are few techniques to execute slow code that returns some data in Android. By slow code I mean network, file, database access etc.
Thread and Runnable can be used, but I found that getting ...
4
votes
3
answers
1k
views
Does Kotlin Coroutines replace AsyncTask?
Is AsyncTask still needed?
In Android with Java, we used to implement an AsyncTask and AsyncTaskLoader, but recently I've been beginning to learn Kotlin and I've noticed that things like that are done ...
0
votes
0
answers
118
views
How to auto connect to server?
I make a android application connect to server by using "com.mysql.jdbc.Driver".
I make a class for creating a connection as a AsyncTask.
public class MySqlConnection extends AsyncTask<...
1
vote
0
answers
79
views
Android/Java: HereMap Cant download Map w/ Class: I/Choreographer: Skipped 1390 frames! The application may be doing too much work on its main thread
I try to download the map of HereMap to use it offline, but when I create a class for this Here Map download, it initialized well, but the download is not starting...
The error message is:
I/...
1
vote
0
answers
234
views
The AsyncTask API is deprecated in Android 11. How to modify this code?
The AsyncTask API is deprecated in Android 11. How to modify this code?
I was reading about AsyncTask, and I tried the simple program below. But it does not seem to work. How can I make it work?
...
0
votes
0
answers
54
views
Async calls within Dart Stream processing
I'm aware of similar questions, but, they don't quite do it. I want to get NTP time and access an URL whenever an NFC token is read. I'm modifying the example from nfc_in_flutter. So, I have this:
...
1
vote
1
answer
70
views
How to replace AsyncTask in this code to find places according to a api call string
I'm getting this issue on my personal android project:
i want to use google places api call to show and mark nearby and specific places on map
but it does not work as intended because asyncTasks are ...
0
votes
1
answer
39
views
Why does this web service code not output?
I am a beginner Android developer, I wrote this code related to web service, but this program has no output (I am not getting any error). And I'm sure that the API is correct, but it doesn't show ...
0
votes
0
answers
170
views
AsyncTask.THREAD_POOL_EXECUTOR deprecated API 30
I'm trying to implement the solution of this answer IdlingResource Espresso with RxJava but AsyncTask.THREAD_POOL_EXECUTOR is deprecated. What I should use instead?
1
vote
0
answers
345
views
Using Executer instead of AsyncTask to Get Data From Room Database in Android
I am new to this concept and trying to follow a YouTube tutorial, in the video, he used AsyncTask to add the note object to the DB and AsyncTask to retrieve the data
He used this code to add the notes ...
1
vote
1
answer
69
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
3
answers
83
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 ...
1
vote
0
answers
321
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
1
answer
65
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 ...