Hi,
I have a VideoView in a LinearLayout with 2 other boxes. In trying to
create a full screen video, I am doing the following:
private boolean isFullScreen = false;
public void onClick(View v)
{
VideoView vv = (VideoView) v.findViewById(R.id.videoView1);
LinearLayout.LayoutParams lp =
(LinearLayout.LayoutParams)vv.getLayoutParams();
if (isFullScreen)
{
isFullScreen = false;
lp.weight = 0.2f;
vv.setLayoutParams(lp);
v.invalidate();
}
else
{
isFullScreen = true;
lp.weight = 0f;
vv.setLayoutParams(lp);
v.invalidate();
}
Log.v(LogName.onClick, "Video switch to " + (isFullScreen ?
"Full
screen" : "Normal size"));
}
I am getting an exception:
01-26 04:12:20.380: E/AndroidRuntime(8010): FATAL EXCEPTION: main
01-26 04:12:20.380: E/AndroidRuntime(8010):
java.lang.ClassCastException:
android.widget.RelativeLayout$LayoutParams
01-26 04:12:20.380: E/AndroidRuntime(8010): at
com.elliptictech.hdcprx.gui.PlayVideo.onClick(PlayVideo.java:54)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
android.view.View.performClick(View.java:2538)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
android.view.View$PerformClick.run(View.java:9152)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
android.os.Handler.handleCallback(Handler.java:587)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
android.os.Handler.dispatchMessage(Handler.java:92)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
android.os.Looper.loop(Looper.java:130)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
android.app.ActivityThread.main(ActivityThread.java:3691)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
java.lang.reflect.Method.invokeNative(Native Method)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
java.lang.reflect.Method.invoke(Method.java:507)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
01-26 04:12:20.380: E/AndroidRuntime(8010): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
Can anyone suggest why this is the case? Alternatively, can you
suggest another method to set the video view to full screen?
Best regards,
-jm
--
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