Hi,

(1) This thing is working:

I have written a service (say, S) and a class (say manager, M) that
uses that service and they also have a common interface defined by
aidl file. I have a custom class (say, C) that is passed from M to S,
and so I implemented parcelable interface for C and everything works
fine.

public class C implements parcelable{
  //parcelable related things

  public int foo(int n){
    //something;
  }
}

object_of_M.method(new C()); // within this method C's foo() is
used.


(2) This thing is not working:

But now I am creating another class (say A) that extends C and it only
has overridden the method foo(). A looks like this:

public class A extends C {
 public int foo(int b){
   //this is the overridden method.
 }
}

Then I call the method like:

object_of_M.method(new A());

My problem is, everything compiles and builds fine. But when I call
the 'method' of M, it is not working properly. foo() is not working as
a virtual method. Instead of calling A's foo(), C's foo() is being
called.

What change I need to do so that the virtual method overriding concept
still works in this case?


NOTE: what I am trying to do is to supply user specified logic to the
service S. And I want that user can just extend C and override
foo().






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

Reply via email to