CWAC ParcelHelper: Runtime Assistance for Parcel Developers
If you are creating reusable libraries using the techniques described in the Android Parcel Project, then this library may be useful to you.
It supplies you with a
ParcelHelper class, designed to help you
deal with the naming conventions required of resources packaged
in a reusable library.
This is packaged as an Android library project, though a simple JAR is also available from the Downloads section of this GitHub repository.
Your library's code creates a
ParcelHelper instance, supplying it
with your library's name (e.g., my-parcel) and a
for looking up resource IDs. Then, when you need a resource ID,
you call one of the
ParcelHelper getter methods:
getLayoutId()for layouts (replacing
getItemId()for item IDs (replacing
getMenuId()for menus (replacing
getDrawableId()for drawables (replacing
getStyleableId()for so-called "styleables" (replacing
getStyleableArray()for getting the
intarray of "styleables"
getIdentifier()for anything else
Each of those takes the original name of the resource (e.g.,
as a parameter.
getIdentifier() takes the type of the resource as
the second parameter (e.g.,
"string" for a string resource).
The advantage of using
ParcelHelper is two-fold:
- It caches the lookups, since they are relatively expensive.
- It automatically mangles in your parcel name wherever it is needed.
None at present.
This is version v0.2.0 of this library.
The code in this project is licensed under the Apache Software License 2.0, per the terms of the included LICENSE file.
If you have questions regarding the use of this code, you are out of luck, as this project is discontinued.
v0.2.0: converted to Android library project