Hello.

I've created a Class that extends android.content.intent and called it
ExtIntent.
The reason was to give the Intent the possibility to hold a simple
Object. (just for testing)

In my calling Activity, I created an instance of ExtIntent and set it
up like the normal way for
an Intent. Althoug I added my Object in my overridden Constructor as
the third parameter.

=== CODE -> ExtIntent Class ===
...

public class ExtIntent extends Intent
{

  private Object object = null;

...

  public ExtIntent(String action, Uri uri, Context packageContext,
Class<?> cls)
  {
    super(action, uri, packageContext, cls);
    // TODO Auto-generated constructor stub
  }

  public ExtIntent(Context packageContext, Class<?> cls, Object o)
  {
    super(packageContext, cls);
    setObject(o);
  }

  public void setObject(Object object)
  {
    this.object = object;
  }

  public Object getObject()
  {
    return object;
  }
...

}
=== END ===

=== CODE -> Calling Activity ===
...
ExtIntent ei = new ExtIntent(CallingActivity.this,
RetrievingActivity.class, myObject);

startActivity(ei);
...
=== END ===

Now follows the line where I got a ClassCastException.

=== CODE -> Recieving Activity ===
...
ExtIntent ei = (ExtIntent)getIntent();
...
=== END ===

I guess that internally my ExtIntent has been casted to an Intent, but
I'm not sure.

If my assumption is true, there seems to be no way to extend the
Intent class.
How to work really object-oriented if there is no way to extend any
class???

Hopefully I look forward for an answer and/or a solution for that
problem.

Regards

OC

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