Matthew Patience wrote:
> I am attempting to make a VideoView to obviously play videos on. When
> I use the following code though I get the error "Cannot cast from View
> to VideoView" on the marked line below.
>
> public class VideoView extends Activity {
>
> private String video_link;
> private VideoView video_view;
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.youtube_player);
>
> video_view = (VideoView) findViewById(R.id.video_view); ***ERROR
> "Cannot cast from View to VideoView"
>
> Bundle video_bundle = getIntent().getExtras();
> video_link = video_bundle.getString("LINK");
>
> }
>
> }
>
> I have pretty much copied exactly what is shown in the API Demo
> included in the SDK. Not sure what I've done wrong.
You have named your Activity subclass "VideoView". That name will take
preference over android.widget.VideoView. I would recommend you change
the name of the activity to something that won't collide with an SDK class.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android Training...At Your Office: http://commonsware.com/training
--
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