@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.tablet_horizontal_livestreaming, container, false);
    menuButton = (Button) rootView.findViewById(R.id.menu_button);
    textView = (TextView) rootView.findViewById(R.id.menu_text);
    menuButton.setOnClickListener(this);

    vidoesList = new ArrayList<Video>();
    cheatListView = (ListView) rootView.findViewById(R.id.hor_treaminglistView);

    Config.prefs =
        this.getActivity().getSharedPreferences(Config.APP_PREFS_NAME, getActivity().MODE_PRIVATE);
    Config.editor =
        this.getActivity()
            .getSharedPreferences(Config.APP_PREFS_NAME, getActivity().MODE_PRIVATE)
            .edit();

    cheatListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            String url = vidoesList.get(position).getUrl();

            Intent playerIntent = new Intent(getActivity(), YoutubePlayer.class);
            playerIntent.putExtra("video_id", url);
            startActivity(playerIntent);
          }
        });
    final String url = Config.recordedGamesURL;
    ConnectionDetector connectionDetector = new ConnectionDetector(getActivity());
    if (connectionDetector.isConnectingToInternet()) {

      boolean recordgamecheck = Config.prefs.getBoolean("livegamecheck", false);
      if (recordgamecheck) {
        CommonFunction commonFunction = new CommonFunction();
        String response = Config.prefs.getString("livegameresponse", "");

        if (response.equals("")) {
          Toast.makeText(getActivity(), "No videos found", Toast.LENGTH_SHORT).show();

        } else {

          vidoesList = commonFunction.parseResult(response);
          videosAdapter = new VideosAdapter(getActivity(), vidoesList);
          cheatListView.setAdapter(videosAdapter);
        }

      } else {
        new AsyncHttpTask().execute(url);
      }

    } else {

      Toast.makeText(getActivity(), "Check your internet connection", Toast.LENGTH_SHORT).show();
    }

    return rootView;
  }
    @Override
    protected Integer doInBackground(String... params) {
      InputStream inputStream = null;
      HttpURLConnection urlConnection = null;
      Integer result = 0;
      try {
        /* forming th java.net.URL object */
        URL url = new URL(params[0]);
        urlConnection = (HttpURLConnection) url.openConnection();
        /* optional request header */
        urlConnection.setRequestProperty("Content-Type", "application/json");

        /* optional request header */
        urlConnection.setRequestProperty("Accept", "application/json");

        /* for Get request */
        urlConnection.setRequestMethod("GET");
        int statusCode = urlConnection.getResponseCode();

        /* 200 represents HTTP OK */
        if (statusCode == 200) {
          inputStream = new BufferedInputStream(urlConnection.getInputStream());
          CommonFunction commonFunction = new CommonFunction();
          String response = commonFunction.convertInputStreamToString(inputStream);

          Config.editor.putString("livegameresponse", response);
          Config.editor.commit();

          vidoesList = commonFunction.parseResult(response);
          result = 1; // Successful

        } else {
          result = 0; // "Failed to fetch data!";
        }

      } catch (Exception e) {
        Log.d(TAG, e.getLocalizedMessage());
      }

      return result; // "Failed to fetch data!";
    }