Skip to main content

All Questions

1 vote
2 answers
1k views

How to replace AsyncTask onProgressUpdate() using Runnable callbacks

I'm trying to replace deprecated AsyncTask without using Kotlin Coroutines or others libraries, so I have MyTask objects with following structure public abstract class MyTask<R> implements ...
AndreaF's user avatar
  • 12.3k
-1 votes
1 answer
68 views

Android java AsyncTask wait onPostExecute return method

I wrote the following code, I'm looking for a way to make an http call, process the data and let me return the result. The problem being an async operation, when I do html.getTi(), gives me no value ...
Paul's user avatar
  • 4,302
0 votes
2 answers
3k views

assign external variable to the result of a callback inside AsynckTask

private class exampleTask extends AsyncTask<String, Void, SomeResult>{ @Override protected SomeResult doInBackground(String... urls) { SomeResult res ; someMethod(new ...
Aymane Bo's user avatar
0 votes
1 answer
257 views

Run View listener callback code in asynctask thread Android

I run the following code in an asynctask. For some reason, though, the onGlobalLayout code is run in my main activity thread. How can I stop this and make sure the code is run in my asynctask thread? ...
Userrrrrrrrr's user avatar
0 votes
1 answer
46 views

asynctask with callback - cant display images

Cannot display images.. unless putting the adding code in the callback function. But because i ve to cycle draw operation, ive just used the assignment imageHandler = image; it seems to not work ...
Armando Alberti's user avatar
1 vote
5 answers
1k views

Android, Async, CallBack and UI

I have one tough problem with combining this things in a whole. Example: I want to get user location and update UI with latitude and longitude values. Because I stick up to the MVC pattern, I've ...
Vitaly Sulimov's user avatar
3 votes
1 answer
422 views

Android callback listener - send value from pojo in SDK to an application's activity

I have a java class buried deep in an SDK that performs an action and returns a boolean. It has no knowledge of the application's main activity, but I need the main activity to receive that boolean ...
Patricia's user avatar
  • 5,069
0 votes
1 answer
262 views

Trying to understand callbacks using interfaces after the onPostExecute() method of an AsyncTask

I have an AsyncTask anonymous class and I want to send the data that it generates back to an activity class without having to stall the UI thread by using .get(). I am having some trouble though. I ...
Antonis427's user avatar
  • 1,012
2 votes
4 answers
6k views

Return a value from callback which is situated in an async task doInBackGround

I have the following bit of code: here is a link to the doucmentation fo rthe asyncHttp: Link This is what calls the login task: mAuthTask = new UserLoginTask(); mAuthTask.execute((Void) null); ...
Zapnologica's user avatar
  • 22.5k
1 vote
4 answers
544 views

AsyncTask callback not calling

I am having a problem with getting the result from an asyncTask in a separate class. I have followed from a similar questions answer on here but I cant see where I have gone wrong. My AsyncTask is in ...
J4C3N-14's user avatar
  • 696
2 votes
3 answers
4k views

Android Interface class from another class show null pointer exception

public class MainActivity extends Activity Implements ICallInterface { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R....
NovusMobile's user avatar
  • 1,823
2 votes
1 answer
234 views

techniques of asynchronous tasks

Ho do you perform asynchronous tasks and notify about their finishing? I see the next approaches(they are related, but...) for doing it: AsynchTask (SwingWorkerTask) where there are the such methods ...
pvllnspk's user avatar
  • 5,757
1 vote
3 answers
3k views

How access parent class view from callback function in AsyncTask?

Here is my sample code. public class test extends Activity { private TextView tv; public class Blap extends AsyncTask<String,String,Boolean>{ private test parent; @Override ...
uzer's user avatar
  • 160
0 votes
2 answers
1k views

AsyncTask without callback interface

I'm trying to resolve this problem: I have a class that extends from AsyncTask, that execute some http methods, something like this: public class RESTManager extends AsyncTask<Object, Object, ...
skabo's user avatar
  • 71
2 votes
5 answers
5k views

NullpointerException when using callback function in AsyncTask

There are 2 Classes and 1 Interface: Class 1 = LoginPage, Class 2 = SyncData and Interface = AsyncTaskCompleteListener. Class 1 uses Class 2 to sync information with the server. After Class 2 posts ...
Aerial's user avatar
  • 1,185