Parcelable & Service not working together :(

Put your problem here if it does not fit any of the other categories.

Parcelable & Service not working together :(

Postby vishna » Tue Nov 04, 2008 10:47 am

Is there any working example where a service exposes interface that uses custom class implementing Parcelable. It seems like I am doing everything OK but I end up with the Issue 903. I can circumvent this by adding many params to my aidl interfaces but that looks ugly.
vishna
Junior Developer
Junior Developer
 
Posts: 10
Joined: Tue Sep 16, 2008 1:37 pm

Top

Postby mrosseel » Tue Nov 04, 2008 11:23 am

I'm one of the voters to that bug and it currently stops me from developing for my android app. Any fixes or workarounds are welcome!

How many params did you add and where? Interesting tip I'll try that myself.

Mike
mrosseel
Developer
Developer
 
Posts: 25
Joined: Sun Sep 21, 2008 11:19 am

Postby haden » Tue Nov 04, 2008 1:19 pm

Your can try the panoramio app provided by google.

http://code.google.com/p/apps-for-andro ... e/checkout
haden
Experienced Developer
Experienced Developer
 
Posts: 74
Joined: Thu Sep 11, 2008 11:51 am

Postby vishna » Tue Nov 04, 2008 2:18 pm

mrosseel wrote:How many params did you add and where? Interesting tip I'll try that myself.
Mike


Well that's rather straightforward, assuming you have a
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. class Person{String name, String surname}
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

you define a method in your aidl file e.g.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. interface ISomeService{
  2.   sendPerson(in String name, in String surname);
  3. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


...after that you decompose your class to built-in types with getters and reconstruct your class on the other side with setters - the same idea that sits behind Parcelable but less maintainable

the following would be much better and cleaner solution but obviously does not work

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. // Please note that Person must implement Parcelable now
  2. interface ISomeService{
  3.   send(in Person person);
  4. }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


haden wrote:Your can try the panoramio app provided by google.


Even though there is a class implementing Parcelable there is no usage of it within aidl files since there are none, nor any background services.
vishna
Junior Developer
Junior Developer
 
Posts: 10
Joined: Tue Sep 16, 2008 1:37 pm

Postby mrosseel » Tue Nov 04, 2008 2:31 pm

thanks for the explanation, that's indeed a solution but a bit dirty :)

Even if I uncomment the parcelables in my aidl file eclipse continues giving me the 'bad type' error. That's the most frustrating part actually.

The Panoramio app has no aidl files as you mention so I don't think we can learn much from it.
mrosseel
Developer
Developer
 
Posts: 25
Joined: Sun Sep 21, 2008 11:19 am

Postby vishna » Tue Nov 04, 2008 2:46 pm

i hope this workaround is only temporary
vishna
Junior Developer
Junior Developer
 
Posts: 10
Joined: Tue Sep 16, 2008 1:37 pm

Top

Postby vishna » Sat Nov 08, 2008 7:33 pm

OK there is better workaround which gets Parcelable working, simply remove all comment lines in project.aidl, solution from Issue 903
vishna
Junior Developer
Junior Developer
 
Posts: 10
Joined: Tue Sep 16, 2008 1:37 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 14 guests