gDay Mate
Well, no exception. Google dazzles us all with their supreme Mate technology – short for Machine Assisted Temporal Extraction. Its the beginning of Future searches!!! Just put in the keywords and search for items that may appear tomorrow!!
I was a bit skeptical to see how it actually works but man its amazing! Looks like I wont have to be working ever again!!
Here’s the link!!
http://www.google.com.au/intl/en/gday/index.html
Android Hack – Parcellable in eclipse
Long story short – I have been playing around with android.
wow. Amazing platform. Ok so the sdk is not all that well documented but it is getting better by the day. Ofcourse due to its young age, it is nowhere near the flex sdk in terms of the ease of use, documentation and ide, but hey a great start. And there are tons of samples out there ofcourse.
Anyhoo today is about one of the many problems and a fix I stumbled across – Including Parcelables in eclipse projects.
Background:
It is very easy to create remote services in android. A remote service runs in the corner handling requests by activities (or other processes in general) that need to use them (essentially server like processes). By following the tutorial above, you will find that “aidl” files come in 2 flavours.
1. Include the interface definition of an interface.
2. Contain a single statement “parcelable xxxx”, indicating that class xxxx can be marshalled and unmarshalled (into Parcel objects) so instances of xxxx can be communicated between processes.
With step 1, an aidl file YYYYY.aidl automatically gets built into YYYYY.java which contains a lot of stub and other helper functions to take care marshalling and remote method invocation and yada yada yada. This seems to be an automatic thing with eclipse.
With step 2, the .java already exists, and hence the need to use the “parcelable” keyword to indicate that “there exists a corresponding XXXX.java that is already parcelable so do NOT create a .java file again”, but eclipse does not understand this.
Worse still, it is intuitive to place the aidl files along with all your other sources. The fix involves NOT doing this.
Your project will have usually have the following structure:
<project>
—- .classpath
—- .project
—- .settings/
—- bin/
—- src/
——– package1
————file1.java —> This is parcellable
————file2.java
——– package2
————interface1.java
————class2.java —-> This is parcellable
and so on
the key is to add another folder at the same level and structure as the “src” folder(I called mine aidl).
So the new structure looks like this:
<project>
—- .classpath
—- .project
—- .settings/
—- bin/
—- src/
——– package1
————file1.java —> This is parcellable
————file2.java
——– package2
————interface1.java
————class2.java —-> This is parcellable
—- aidl/
——– package1
————file1.aidl —> This is parcellable
——– package2
———— class1.aidl —-> a sample interface definition with no corresponding .java files ANYWHERE
————class2.aidl —-> This is parcellable
the aidl files that exist in your src folder, have their corresponding aidl files in the aidl folder in the same package structure.
Now good news is since the aidl folder exists in your <project> folder, it will be picked up by eclipse (on a refresh). However there is still one minor issue. aidl file class1.aidl will not be automatically compiled to class1.java. To do this, we need to add the entire aidl folder as a “source” folder. Simple. do this:
add an entry like so in the .classpath file!! (ah ha)
<classpathentry kind=”src” path=”aidl”/>
This essentially says, “i have another folder called ‘aidl‘ that is a source folder”.. voila, being a source folder it will get included in auto-builds.
Beauty of this is that for class2.aidl and file1.aidl (in your aidl folder), no .java file will be created as they already exist, however class1.java will be built.
Saves a huge pain in the rear side (i couldnt spell “posterior”)!
good luck. please let me know if ive missed something.
PS <08/03/2008>
Please see Comment # 2 for further clarifications (and speculations too). Thanks for trickybit (Comment #1) for inspring that!
-
Recent
-
Links
-
Archives
- October 2009 (1)
- August 2009 (1)
- May 2009 (1)
- January 2009 (1)
- December 2008 (1)
- November 2008 (1)
- October 2008 (1)
- August 2008 (1)
- June 2008 (1)
- May 2008 (2)
- April 2008 (1)
- March 2008 (2)
-
Categories
-
RSS
Entries RSS
Comments RSS