Extending the Intent class ... received ClassCastException
<p>I am attempting to create an enhanced <code>Intent</code> class (I call it <code>DataIntent</code>) by giving it the ability to hold a "payload" of type Object (versus using it's built-in facility for <code>Uri</code>'s). <code>DataIntent</code> extends Android's <code>Intent</code> class.</p>

<p>My <code>Activity</code> creates the extended object without any problems and the invocation of the <code>startActivityForResult()</code> goes off without any problems also. But, in my responding <code>Activity</code> when I call the <code>getIntent()</code> method, and attempt to cast it to my <code>DataIntent</code>, I'll throw the <code>ClassCastException</code>.</p>

<p>I realize this is probably a very dumb question - a 1,000 appologies in advance - but does anyone know why I cannot cast it to the <code>DataIntent</code> since that's what was used to start the new <code>Activity</code>, and <code>DataIntent</code> is a child of <code>Intent</code>?</p>

<pre><code>DataIntent dataIntent = (DataIntent)getIntent(); 
 // invoked inside the responding Activity instance - throws a ClassCastException
</code></pre>
