android - How does a member variable from a subclass of ResultReceiver get included in the Parcel read/write process? -
Answer this question about the code I have tested it and it works for the purpose of my question To make it a bit dense, it is to understand how the member avoids the process of writing a MyResultReceiver parcel in the variable mReceiver class:
Intent Input Extra ("Receiver", MREC);
and the process of reading:
the end result receiver receiver = intent.getParcelableExtra ("receiver");
When the send method is called on receiver , because there is no code, I use parcel on MRC Strong> Member variables, I hope mReceiver should be empty, but it is not so, why?
Full code example:
Expands the public class home activity activity MyResultReceiver.IReceiver {public MyResultReceiver mReceiver; Public Zero (Bundle Saved Instantestate) on Create {mReceiver = New MyResultReceiver (new handler ()); MReceiver.setReceiver (this); Last intent = intent (intent.ACTION_SYNC, empty, this, QueryService.class); Intent.putExtra ("Receiver", MRECER); Intent.putExtra ("command", "query"); StartService (intent); }} Public Category QueryService IntentService {Secure void onHandleIntent} {Last ResultReceiver Receiver = intent.getParcelableExtra ("Receiver"); Receiver. Send (0, bundle. AMPTI); }} Expands the Public MyResultReceiver ResultReceiver {Private IRSaver MREC; Public MyResultReceiver (handler handler) {super (handler); } Public Zero Set Receiver (Receiver Receiver) {mReceiver = Receiver; } Public Interface IRSever {Receive Result on Public Zero (IT Results, Bundle ResultsData); } @ Override Rescue Result on Integrated Zero (Integer Results Code, Bundle ResultsData) {if (MRC! = Null) {MREC. Repeated results (result code, result data); }}}
Comments
Post a Comment