Waiting for asynchronous callback in Android's IntentService

后端 未结 6 1619
栀梦
栀梦 2021-02-05 03:08

I have an IntentService that starts an asynchronous task in another class and should then be waiting for the result.

The problem is that the IntentSer

6条回答
  •  梦毁少年i
    2021-02-05 03:58

    You are doomed without changing MyOtherClass.

    With changing that class you have two options:

    1. Make an synchronous call. IntentService is already spawning a background Thread for you.
    2. Return the newly created Thread in runAsynchronousTask() and call join() on it.

提交回复
热议问题