Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:21:40+00:00 2026-05-28T14:21:40+00:00

I have an applications that I’ve built to target SDK 3.0. In this application

  • 0

I have an applications that I’ve built to target SDK 3.0.

In this application there is a relative layout that has a full screen VideoView with a button underneath it. The video view has an onTouchListener set on it that is listening for a gesture.

After the video completes the VideoView is set to visibility(View.GONE) On devices running Honeycomb(Toshiba Thrive, and HTC Flyer) this functions as I would expect it to. Once the VideoView is GONE the button is clickable just fine.

However on a device running ICS (Motorola Xoom) when I try to press the button the event goes to the VideoView touch listener rather than the buttons click listener.

Was the way that Views are intended to behave in this situation changed purposely on ICS or is this a bug?

Additionally the first thing that I tried to solve this problem also gave me some strange results.

I added these lines instead of the setVisibility(View.GONE);

    Log.i(MainActivity.myTag, "vid is null ? " + (mVideoView == null));
    Log.i(MainActivity.myTag, "lyt is null ? " + (vidLyt == null));
    vidLyt.removeView(mVideoView); //This line throws null pointer

thinking that if the VideoView gets removed from my parent layout it would certainly no longer be accepting touch events.

but this causes a null pointer on the removeView() call. Even though the Log statments above it indicate that both of the Objects are in fact not null. Here is the exception:

As far as I can tell it doesn’t actually point to any line in my activity, but these 3 statements are the only 3 getting called at this time and both Log statments complete successfully.

01-20 16:32:42.480: ERROR/AndroidRuntime(9416): java.lang.NullPointerException
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2488)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.View.getDisplayList(View.java:10415)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.View.getDisplayList(View.java:10380)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.View.getDisplayList(View.java:10380)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.View.getDisplayList(View.java:10380)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:840)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.ViewRootImpl.draw(ViewRootImpl.java:1910)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.os.Looper.loop(Looper.java:137)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at android.app.ActivityThread.main(ActivityThread.java:4424)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at java.lang.reflect.Method.invokeNative(Native Method)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at java.lang.reflect.Method.invoke(Method.java:511)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-20 16:32:42.480: ERROR/AndroidRuntime(9416):     at dalvik.system.NativeStart.main(Native Method)

EDIT: here are the relevant sections.

        mVideoView.setOnTouchListener(new OnTouchListener() {
            public boolean onTouch(View v, MotionEvent me){
                if(me.getAction() == MotionEvent.ACTION_DOWN){
                    touchY = me.getY();
                    //I am using the if statement below to fix the unexpected behavior currently.
                    //by returning false even though the VideoView receives the touch, this 
                    //causes it to essentiall ignore it and pass it along to the button.
                    if(mVideoView.getVisibility() == View.GONE){
                        return false;
                    }
                }else if(me.getAction() == MotionEvent.ACTION_UP){
                    Log.i(MainActivity.myTag, "Old = " + touchY + " New = " + me.getY());
                    //Moved north a little is the gesture I am interested in.
                    if(me.getY() < (touchY - 100)){


                        Thread t = new Thread() {
                            public void run(){
                                timeStamp = mVideoView.getCurrentPosition();
                                mVideoView.stopPlayback();

                                //Since we are in back thread use a handler to GONEify the VideoView
                                animVidHandler.sendEmptyMessage(0);

                                //There is some network stuff here that justifies the use of a
                                //different thread. But I am certain it isn't affecting the
                                //behavior of my views.

                            }
                        };
                        t.start();
                    }
                }
                return true;
            }
        });

inside the handler callback is only 1 statment:

mVideoView.startAnimation(flyOffAnim); //translate animation to "fly off" the screen.

I forgot to mention the animation before. Could that have something to do with this behavior?

The flyOffAnimation has a completionListener set on it that only contains 1 statement:

mVideoView.setVisibility(View.GONE);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:21:41+00:00Added an answer on May 28, 2026 at 2:21 pm

    Was the way that Views are intended to behave in this situation changed purposely on ICS or is this a bug?

    VideoView is really a SurfaceView, which really isn’t a normal View, though it plays one on TV.

    As far as I can tell it doesn’t actually point to any line in my activity, but these 3 statements are the only 3 getting called at this time and both Log statments complete successfully.

    You are not getting a NullPointerException from those three statements. You are getting a NullPointerException elsewhere as a side effect of those three statements, perhaps. I don’t know why you would, in this case.

    Perhaps try switching to having both be peers in a ViewFlipper and switching between modes that way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our application, there are a bunch of unit test console applications that have
I have two .net applications that run on the same machine. The first application
I have a few applications that I have built that leverage MSMQ on a
For example, I've seen third-party applications that have functions like this: $db->select('columns')->from('table')->where('condition'); That's just
I have applications(WinForm) that gets some objects from webservice. After receiving array I transform
I have several applications that are part of a suite of tools that various
I have clustered applications that requires one of the nodes to be designated as
We have 2 applications that run under JBoss. I am looking for a way
I have three applications that talk to each other using sockets. They can all
We have some applications that sometimes get into a bad state, but only in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.