Oh, I didn't realize it wasn't in the SDK. In that case, be sure to use a different package name when you copy the code. It might appear to use the version pre-loaded by zygote just fine, but that would break in the future if we update the library.
j On Wed, May 6, 2009 at 5:18 PM, Dianne Hackborn <[email protected]> wrote: > This is not available in the SDk, you will need to compile a copy into your > app. > > On Wed, May 6, 2009 at 5:15 PM, Inderjeet Singh <[email protected]> wrote: >> >> This is great! Is it available only in cupcake or older versions as well? >> >> Thanks >> Inder >> >> On Wed, May 6, 2009 at 5:08 PM, Jeff Sharkey <[email protected]> wrote: >> > >> > 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 <[email protected]> >> > 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 >> > [email protected] >> > >> > > >> > >> >> > > > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. > > > > > -- Jeff Sharkey [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

