On Wed, Nov 2, 2011 at 1:45 PM, randyv2 <randythech...@gmail.com> wrote:
> I'm using this as a way to implement a callback from my service, so
> I'm using the interface as a way to pass data from the service to the
> callback.

Um, I'll be surprised if what you propose here is stable. I don't
think out parameters are designed for long-term use, just for a single
call (which is equivalent to returning the value). The primary
advantage of out parameters is that you can have more than one.

If you want to implement a callback, then you should implement a callback:

-- define an AIDL interface for the callback
-- have your method take an instance of that callback as a regular
(in) parameter
-- create a .Stub implementation of the callback in the client and
supply an instance of it when calling the service's exposed method
-- the service receives the proxy as the parameter to its method
implementation and can use that as needed

The RemoteClientEx and RemoteServiceEx examples in this directory
demonstrate this:

https://github.com/commonsguy/cw-advandroid/tree/master/AdvServices

 Making the change you've suggested wouldn't work in this
> case.  That said, if you've got a suggestion for a different approach
> to this problem I'd love to hear it.
>
> On Nov 2, 4:42 am, Mark Murphy <mmur...@commonsware.com> wrote:
>> Try switching to:
>>
>> Map success();
>>
>> It may be that Map does not support out properly. I have never used
>> the out keyword in AIDL, as it leads to scary programming (relying on
>> side-effects applied to parameters).
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Oct 31, 2011 at 9:52 PM, randyv2 <randythech...@gmail.com> wrote:
>> > I have an AIDL written as follows:
>>
>> > interface IGameInterfaceResult {
>> >        void success(out Map result);
>> > }
>>
>> > In the generated .java file, I see this being generated:
>>
>> > _arg0 = new java.util.Map();
>>
>> > This leads to my project having errors because Map can't be
>> > instantiated.  This seems like a bug in the AIDL tool, but my googling
>> > hasn't resulted in anything useful regarding this error.  Does anybody
>> > have suggestions on what I should try doing to resolve this problem?
>>
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Android Developers" group.
>> > To post to this group, send email to android-developers@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > android-developers+unsubscr...@googlegroups.com
>> > For more options, visit this group at
>> >http://groups.google.com/group/android-developers?hl=en
>>
>> --
>> Mark Murphy (a Commons 
>> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>>
>> _Android Programming Tutorials_ Version 4.0 Available!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 4.0 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to