title: click on textview on listview on fragment
body: <p>click on textview on listview on fragment</p>
  
  <p>TextView On category_row.xml textViewCategoryName</p>
  
  <p>onclick SetText this textViewCategoryName ok! </p>
  
  <p>CategoriesFragment.java</p>
  
  <pre><code>package com.example;
  
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.design.widget.Snackbar;
  import android.support.v4.app.Fragment;
  import android.support.v4.widget.ContentLoadingProgressBar;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.ListView;
  import android.widget.TextView;
  
  import com.example.adapter.CategoryArrayAdapter;
  import com.example.model.CategoryDataModel;
  import com.example.parser.JSONParser;
  import com.example.utils.Keys;
  
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.util.ArrayList;
  
  public class CategoriesFragment extends Fragment {
  
      private ListView listView;
      private ArrayList&lt;CategoryDataModel&gt; list;
      private CategoryArrayAdapter adapter;
      private TextView categoryCurrent;
  
      public CategoriesFragment() {
          // Required empty public constructor
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          // Inflate the layout for this fragment
          View rootView = inflater.inflate(R.layout.fragment_categories, null);
  
          return rootView;
      }
  
      @Override
      public void onActivityCreated(@Nullable Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
          /**
           * Array List for Binding Data from JSON to this List
           */
          list = new ArrayList&lt;&gt;();
  
          adapter = new CategoryArrayAdapter(getActivity(), list);
  
          /**
           * Getting List and Setting List Adapter
           */
          listView = (ListView) getActivity().findViewById(R.id.listView);
          listView.setAdapter(adapter);
          listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  Snackbar.make(getActivity().findViewById(R.id.parentLayout), list.get(position).getCategoryName(), Snackbar.LENGTH_LONG).show();
              }
          });
  
          /**
           * Check internet connection
           */
          //if (InternetConnection.checkConnection(getApplicationContext())) {
          new GetDataCategories().execute();
          //} else {
          //Snackbar.make(getActivity().findViewById(R.id.parentLayout), "اتصال به اینترنت برقرار نیست", Snackbar.LENGTH_LONG).show();
          //}
  
      }
  
      /**
       * Creating Get Data Task for Getting Data From Web
       */
      class GetDataCategories extends AsyncTask&lt;Void, Void, Void&gt; {
  
          ContentLoadingProgressBar progressBar;
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
  
              /**
               * Progress Bar for User Interaction
               */
              progressBar = (ContentLoadingProgressBar) getActivity().findViewById(R.id.progress);
              progressBar.show();
          }
  
          @Nullable
          @Override
          protected Void doInBackground(Void... params) {
  
              /**
               * Getting JSON Object from Web Using okHttp
               */
              JSONObject jsonObject = JSONParser.getDataFromWeb("http://example.com/api-service/v1/platform_categories/");
  
              try {
                  /**
                   * Check Whether Its NULL???
                   */
                  if (jsonObject != null) {
                      /**
                       * Check Length...
                       */
                      if(jsonObject.length() &gt; 0) {
                          /**
                           * Getting Array named "Categories" From MAIN Json Object
                           */
                          JSONArray array = jsonObject.getJSONArray(Keys.KEY_CATEGORIES);
  
                          /**
                           * Check Length of Array...
                           */
                          int lenArray = array.length();
                          if(lenArray &gt; 0) {
                              for(int jIndex = 0; jIndex &lt; lenArray; jIndex++) {
  
                                  /**
                                   * Creating Every time New Object
                                   * and
                                   * Adding into List
                                   */
                                  CategoryDataModel model = new CategoryDataModel();
  
                                  /**
                                   * Getting Inner Object from contacts array...
                                   * and
                                   * From that We will get Name of that Contact
                                   *
                                   */
                                  JSONObject innerObject = array.getJSONObject(jIndex);
  
                                  String category_name = innerObject.getString(Keys.KEY_CATEGORY_NAME);
                                  String category_link = innerObject.getString(Keys.KEY_CATEGORY_LINK);
  
  
                                  /**
                                   * Getting Object from Object "other"
                                   */
                                  //JSONObject otherObject = innerObject.getJSONObject(Keys.KEY_NAME);
                                  //String other = otherObject.getString(Keys.KEY_NAME_SUB);
  
  
                                  model.setCategoryName(category_name);
                                  model.setCategoryLink(category_link);
  
                                  /**
                                   * Adding data in List...
                                   */
                                  list.add(model);
                              }
                          }
                      }
                  } else {
  
                  }
              } catch (JSONException je) {
                  Log.i(JSONParser.TAG, "" + je.getLocalizedMessage());
              }
              return null;
          }
  
          @Override
          protected void onPostExecute(Void aVoid) {
              super.onPostExecute(aVoid);
  
              /**
               * Progress Bar for User Interaction
               */
              progressBar.hide();
  
              /**
               * Checking if List size if more than zero then
               * Update ListView
               */
              if(list.size() &gt; 0) {
                  adapter.notifyDataSetChanged();
              } else {
                  Snackbar.make(getActivity().findViewById(R.id.parentLayout), "مشکلی در اتصال به سرورهای سخنک رخ داده است!", Snackbar.LENGTH_LONG).show();
              }
          }
      }
  
  }
  </code></pre>
  
  <p>CategoryArrayAdapter.java</p>
  
  <pre><code>package com.example.adapter;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.RelativeLayout;
  import android.widget.TextView;
  
  import com.example.R;
  import com.example.model.CategoryDataModel;
  
  import java.util.List;
  
  public class CategoryArrayAdapter extends ArrayAdapter&lt;CategoryDataModel&gt; {
  
      List&lt;CategoryDataModel&gt; modelList;
      Context context;
      private LayoutInflater mInflater;
  
      // Constructors
      public CategoryArrayAdapter(Context context, List&lt;CategoryDataModel&gt; objects) {
          super(context, 0, objects);
          this.context = context;
          this.mInflater = LayoutInflater.from(context);
          modelList = objects;
      }
  
      @Override
      public CategoryDataModel getItem(int position) {
          return modelList.get(position);
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          final ViewHolder vh;
          if (convertView == null) {
              View view = mInflater.inflate(R.layout.category_row, parent, false);
              vh = ViewHolder.create((RelativeLayout) view);
              view.setTag(vh);
          } else {
              vh = (ViewHolder) convertView.getTag();
          }
  
          CategoryDataModel item = getItem(position);
  
          vh.textViewCategoryName.setText(item.getCategoryName());
  
          return vh.rootView;
      }
  
      private static class ViewHolder {
          public final RelativeLayout rootView;
          public final TextView textViewCategoryName;
  
          private ViewHolder(RelativeLayout rootView, TextView textViewCategoryName) {
              this.rootView = rootView;
              this.textViewCategoryName = textViewCategoryName;
          }
  
          public static ViewHolder create(RelativeLayout rootView) {
              TextView textViewCategoryName = (TextView) rootView.findViewById(R.id.textViewCategoryName);
              return new ViewHolder(rootView, textViewCategoryName);
          }
      }
  }
  </code></pre>
  
  <p>fragment_categories.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:id="@+id/parentLayout"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context=".MainActivity"&gt;
  
      &lt;android.support.v4.widget.ContentLoadingProgressBar
          android:id="@+id/progress"
          style="?android:attr/progressBarStyleLarge"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:visibility="visible" /&gt;
  
      &lt;ListView app:layout_behavior="@string/appbar_scrolling_view_behavior"
          android:id="@+id/listView"
          android:layout_width="fill_parent"
          android:layout_height="match_parent" /&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>category_row.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &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="wrap_content"
      android:orientation="vertical"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:orientation="vertical"
          android:layout_centerVertical="true"
          android:layout_height="wrap_content"
          android:layout_toLeftOf="@+id/imageViewProfilePhoto"&gt;
  
          &lt;TextView
              android:id="@+id/textViewCategoryName"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="5dp"
              android:textAppearance="?android:textAppearanceSmall"
              android:textIsSelectable="true"
              tools:text="Quote Content" /&gt;
  
  
          &lt;LinearLayout
              android:orientation="horizontal"
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:layout_gravity="right"
              android:layout_alignParentRight="true"
              android:layout_alignParentTop="true"
              android:layout_alignParentLeft="true"
              android:layout_alignParentStart="true"&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>