title: how to disable touch screen event while video is playing in android
body: <p>I am developing kids app in which I have shown youtube videos thumbnails in RecyclerView. On the Click of any listed video thumbnail the video is played in full screen( using YouTube API to fetch the thumbnails and play video in Youtube intent). I am succeed i doing all so. The problem is that i want to disable the touch screen event while the video is playing. Every kind of help is appreciated. Below is my code:<br>
  mainactivity.xml:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:weightSum="2"
      android:orientation="vertical"
      tools:context="com.example.pc.fkidshell.Main4Activity"&gt;
  
      &lt;include layout="@layout/toolbar"
          android:id="@+id/my_thirdtoolbar"/&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/VideoList"
          android:layout_below="@+id/my_thirdtoolbar"
          android:paddingTop="20dp"
          android:scrollbars="vertical"&gt;
  
      &lt;/android.support.v7.widget.RecyclerView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>video_row.xml:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;ImageView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/thumbnailView"
          android:layout_gravity="center_horizontal"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>mainactivity.java:</p>
  
  <pre><code>public class Main4Activity extends AppCompatActivity implements YouTubeThumbnailView.OnInitializedListener, YouTubeThumbnailLoader.OnThumbnailLoadedListener{
      Toolbar third_toolbar;
      YouTubeThumbnailView thumbnailView;
      YouTubeThumbnailLoader thumbnailLoader;
      RecyclerView VideoList;
      RecyclerView.Adapter adapter;
      List&lt;Drawable&gt; thumbnailViews;
      List&lt;String&gt; VideoId;
      String videoid;
  
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main4);
          third_toolbar = (Toolbar) findViewById(R.id.my_thirdtoolbar);
          setSupportActionBar(third_toolbar);
          getSupportActionBar().setTitle(R.string.sectitle);
          getSupportActionBar().setIcon(R.drawable.tblogo);
  
          thumbnailViews = new ArrayList&lt;&gt;();
          VideoList = (RecyclerView) findViewById(R.id.VideoList);
          RecyclerView.LayoutManager layoutManager=new LinearLayoutManager(this);
          VideoList.setLayoutManager(layoutManager);
          adapter=new VideoListAdapter();
          VideoList.setAdapter(adapter);
          VideoId = new ArrayList&lt;&gt;();
          thumbnailView = new YouTubeThumbnailView(this);
          thumbnailView.initialize("API Key", this);
  
      }
  
      @Override
      public void onInitializationSuccess(YouTubeThumbnailView youTubeThumbnailView, YouTubeThumbnailLoader youTubeThumbnailLoader) {
          thumbnailLoader = youTubeThumbnailLoader;
          youTubeThumbnailLoader.setOnThumbnailLoadedListener(Main4Activity.this);
          thumbnailLoader.setPlaylist("PLXRActLQ03oY_6AQb-5EMuKFYQA_fDE40");
      }
  
      @Override
      public void onInitializationFailure(YouTubeThumbnailView youTubeThumbnailView, YouTubeInitializationResult youTubeInitializationResult) {
  
      }
  
      public void add() {
          adapter.notifyDataSetChanged();
          if (thumbnailLoader.hasNext())
              thumbnailLoader.next();
      }
  
      @Override
      public void onThumbnailLoaded(YouTubeThumbnailView youTubeThumbnailView, String s) {
          thumbnailViews.add(youTubeThumbnailView.getDrawable());
          VideoId.add(s);
          add();
      }
  
      @Override
      public void onThumbnailError(YouTubeThumbnailView youTubeThumbnailView, YouTubeThumbnailLoader.ErrorReason errorReason) {
  
      }
  
      public class VideoListAdapter extends RecyclerView.Adapter&lt;VideoListAdapter.MyView&gt;{
          public class MyView extends RecyclerView.ViewHolder{
              ImageView imageView;
              public MyView(View itemView) {
                  super(itemView);
                  imageView= (ImageView) itemView.findViewById(R.id.thumbnailView);
              }
          }
  
          @Override
          public VideoListAdapter.MyView onCreateViewHolder(ViewGroup parent, int viewType) {
              View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.video_row, parent, false);
              return new MyView(itemView);
          }
  
          @Override
          public void onBindViewHolder(VideoListAdapter.MyView holder, final int position) {
              holder.imageView.setImageDrawable(thumbnailViews.get(position));
              holder.imageView.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v)
                  {
                      videoid=VideoId.get(position);
  
                      Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v="+videoid+"&amp;index="+position+"&amp;list=PLXRActLQ03oY_6AQb-5EMuKFYQA_fDE40"));
                      intent.putExtra("force_fullscreen",true);
                      startActivity(intent);
  
                  }
              });
          }
  
          @Override
          public int getItemCount() {
              return thumbnailViews.size();
          }
      }
  }
  </code></pre>