![]() What you are creating is useful, and really very much helpful in the cases where you need some IO operations (such as writing to databases, reading files, downloading from network) etc and that is exactly why AsyncTask and other types are provided, but never intertwine the UI with the background threads. The two should be left alone, and should work in their own contexts. Like already being mentioned, I would pay a great emphasis on the fact that intertwining your synchronous code, with asynchronous code is a bad and poor approach. continue after fetching the required message String test = asyncTask.get() // get some result New BackgroundMessageFinder.AsyncResponse() void processFinish(String output) ).execute(, "999", "457", "", "1234") (BackgroundMessageFinder) new BackgroundMessageFinder(ntext, this, Please feel free if my problem is not clear. If my problem is clear enough, please help me. The code below is what I have tried and I did not incorporated what the asyncTask does.within doInBackground it makes ussd call and automatically enters into while loop to get intercepted message.that there is a ussd interceptor which puts the message on a global shared preference.the while loop searches for this specific message and breaks automatically after matches.so my wish is to get this message and continue onto the next statement. I have been working on a android project, the problem I faced is that I need to wait for asyncTask/service/thread/runnable to finish its job and accept it's result when its done so that the operation continues synchronously, however, the code after the callings of asyncTask/ntinues to execute which I don't need it.I think I really have missed something basic concept.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |