Friday, February 14, 2014

android how to use the BroadcastReceiver.PendingResult


Today at work suddenly encountered PendingResult, looked at their own data, its use is still very vague.
Personal understanding:
1, PendingResult literally is pending results. On Android developer said to be used in the receiver in goSync () after, receiver start asynchronous broadcast out, and this broadcast is ongoing, do not stop. Then you can not use the original BroadcastReceiver to operate, and to use PendingResult to operate.
So I now do some experiments, ordered my Activity broadcast the first receiver receives, and then perform goSync () to get PendingResult object A, with A to manipulate the data, and finally executed finish (). Then the first receiver is not to start an asynchronous broadcast out?

2, the second receiver receives the radio, access to data, perform abortBroadcast is not to terminate the entire broadcast?

3, there are still a lot of argument constructor initializes, I get through PendingResult goSync feel the contradiction? (Do not answer any constructor must have this grammar question, I want to know is transaction mechanism)

4, PendingResult class there clearAbortBroadcast, this is how to use? After clearing will follow the original broadcast it? Are ordered according to the first or subsequent asynchronous?<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->

No comments:

Post a Comment