On Wed, Nov 2, 2011 at 3:26 PM, randyv2 <randythech...@gmail.com> wrote:
> Would it horrify you to know
> that the link you provided is what I was using as a reference when I
> started walking down this road? ;)

That depends. Did you buy the book? :-)

> 1. IGameInterface.aidl - This is the equivalent of IScript.aidl in the
> sample code.  It has one method: void doStuff(IGameInterfaceResult
> callback).
> 2. IGameInterfaceResult.aidl - This is where the definition of the
> interface for the callback goes. As in my original post, it has one
> method: void success(Bundle).

Where the Bundle is an out parameter?

> 3. GameService.java - Ignoring the poor naming convention for a
> moment, this is a subclass of Service and functions as BshService.java
> does in the sample code. It contains code like the following:
>
> public class GameService extends Service {
>  private final IGameInterface.Stub binder = new IGameInterface.Stub()
> {
>    public void doStuff(final IGameInterfaceResult callback) {
>      Bundle coolStuff = makeCoolStuff();
>      callback.success(coolStuff);
>    }
>  };
> }

That doesn't need an out parameter. That's an in parameter -- you are
passing the data *to* the callback. And, since in is the default
direction, you don't need the keyword at all.

Rolling back to my sample, I do the same thing you do, minus the out:

interface IScriptResult {
        void success(String result);
        void failure(String error);
}

>From your original post on this thread, you have:

interface IGameInterfaceResult {
       void success(out Map result);
}

I misunderstood your situation, which is why the Map success()
approach won't work. But, you might try:

interface IGameInterfaceResult {
       void success(Map result);
}

since you don't need the out, and the out is technically wrong in this
case as I understand it. It may be that "out Map" doesn't work,
generating the flawed code you found.

Even if you're using Bundle successfully, I'd drop the out. You'd use
out if the *callback* were trying to pass data in success() back to
the *service*.

-- 
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