Android BroadcastReceiver or simple callback method?

前端 未结 5 1412
情深已故
情深已故 2021-01-29 20:09

In my projects I am using BroadcastReceivers as a callback from a long running thread (eg. notify the activity that a download was finished and send some response d

5条回答
  •  别那么骄傲
    2021-01-29 20:37

    not sure what the goal is , but if you wish to keep the same idea of using intent and broadcastReceiver , and want better performance and security than normal broadcastReceivers , you can try out this demo , available in the android support library :

    http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/content/LocalServiceBroadcaster.html

    if not , you can always use asyncTask , service , handlers , etc...

提交回复
热议问题