0

I'm developing custom Media Controller and i have taken four button(play/pause,next,pre and bandwidth)inside a linear layout.I want when we touch screen then screen then this linear layout should visible for few second and after specified time this should invisible.I have done following code but its not working.

My code

@Override
            public boolean onTouch(View v, MotionEvent event) {
                // TODO Auto-generated method stub
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    if (mShowing) {
                        try {
                            linearl.setVisibility(View.GONE);

                        } catch (IllegalArgumentException ex) {
                            Log.w("MediaController", "already removed");
                        }
                        mShowing =!mShowing ;
                    }
                }
                return false;
            }
        });

So please suggest me how to do this

manlio
  • 18,345
  • 14
  • 76
  • 126
Dilip
  • 2,271
  • 5
  • 32
  • 52

1 Answers1

0

Try this...

  if (event.getAction() == MotionEvent.ACTION_UP) {

                         if(linearLayout.getVisibility() == View.GONE){
                               linearLayout.setVisibility(View.VISIBLE);
                         }
                    }
Mehul Santoki
  • 1,208
  • 1
  • 12
  • 25
  • Hi @Mehul i have a question in this regard,I want to make custom video player and have to add galleryView inside this want to set visibility of gallery according to the mediaController means when we touch videoView gallery should visible and after few times gone like media controller.So if u have any idea please let me know thanks. – Dilip Sep 10 '12 at 07:38
  • if u want to simply visible and invisible gallery for specific time, u can use thread or timer. start timer with visible gallery on thouch event and after specific time stop timer and invisible it. – Mehul Santoki Sep 10 '12 at 12:05