There is a nice tight version of the protobuf library that ships with
the Android platform.  It's got a tiny footprint, and is actually
pre-loaded by zygote so that all apps benefit.

http://android.git.kernel.org/?p=platform/external/protobuf.git;a=tree;f=src/com/google/common/io/protocol;hb=cupcake

There aren't really any good examples on how to use it, but here is a
quick snippet off the top of my head that should be enough to get you
started.  (I've been writing a lot of protobufs recently, lol.)


public static final ProtoBufType Item = new ProtoBufType();
public static final ProtoBufType List = new ProtoBufType();

static {
    Item.addElement(ProtoBufType.OPTIONAL | ProtoBufType.TYPE_STRING,
ItemFields.value, null);
    Item.addElement(ProtoBufType.OPTIONAL | ProtoBufType.TYPE_INT32,
ItemFields.length, null);

    List.addElement(ProtoBufType.REPEATED | ProtoBufType.TYPE_MESSAGE,
ListFields.item, Item);
}

public interface ListFields {
    public static final int item = 1;
}

public interface ItemFields {
    public static final int value = 1;
    public static final int length = 2;
}



Hope this helps.  :)

j



On Wed, May 6, 2009 at 4:32 PM, Inderjeet Singh <inder...@gmail.com> wrote:
>
> Anyone tried using protobuf (http://code.google.com/p/protobuf/) on
> Android? I noticed that the protobuf library jar was over 200k and
> that seems a bit too much. Has anyone experiemented with a stripped
> down version that only does data conversion and skips services?
>
> Thanks
> Inder
>
> >
>



-- 
Jeff Sharkey
jshar...@google.com

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