title: No adapter attached skipping layout in recyclerview using fragment
body: <p>I got an error in recycler view using fragment. I have read stackoverflow answers but it not solve. PLease help me. </p>
  
  <p>Recycler reference tutorial
  <a href="http://www.android-examples.com/android-recyclerview-listview-with-imageview-textview-json/" rel="nofollow noreferrer">http://www.android-examples.com/android-recyclerview-listview-with-imageview-textview-json/</a></p>
  
  <p>When i use in without fragment it work as fine but in fragment it shows error.
  My codes shown below.</p>
  
  <pre><code>FriendsFragment.java
  
  public class FriendsFragment extends android.support.v4.app.Fragment {
  
  
  List&lt;GetDataAdapter&gt; GetDataAdapter1;
  
  RecyclerView recyclerView;
  
  RecyclerView.LayoutManager recyclerViewlayoutManager;
  
  RecyclerView.Adapter recyclerViewadapter;
  
  String GET_JSON_DATA_HTTP_URL = "http://192.168.43.7/work/ecom/2/1.php";
  String JSON_IMAGE_TITLE_NAME = "image_title";
  String JSON_IMAGE_URL = "image_url";
  
  JsonArrayRequest jsonArrayRequest ;
  
  RequestQueue requestQueue ;
  
  public FriendsFragment() {
      // Required empty public constructor
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.fragment_friends, container, false);
  
      GetDataAdapter1 = new ArrayList&lt;&gt;();
      recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview1);
      recyclerView.setHasFixedSize(true);
      recyclerViewlayoutManager = new LinearLayoutManager(getContext());
      recyclerView.setLayoutManager(recyclerViewlayoutManager);
  
      JSON_DATA_WEB_CALL();
  
  
  
      // Inflate the layout for this fragment
      return rootView;
  }
  
  public void JSON_DATA_WEB_CALL(){
  
      jsonArrayRequest = new JsonArrayRequest(GET_JSON_DATA_HTTP_URL,
  
              new Response.Listener&lt;JSONArray&gt;() {
                  @Override
                  public void onResponse(JSONArray response) {
  
                      Log.d("LOGTAG", "Response :"+response);
  
                      JSON_PARSE_DATA_AFTER_WEBCALL(response);
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
  
                  }
              });
  
      requestQueue = Volley.newRequestQueue(getContext());
  
      requestQueue.add(jsonArrayRequest);
  }
  
  
  public void JSON_PARSE_DATA_AFTER_WEBCALL(JSONArray array){
  
      for(int i = 0; i&lt;array.length(); i++) {
  
          GetDataAdapter GetDataAdapter2 = new GetDataAdapter();
  
          JSONObject json = null;
          try {
  
              json = array.getJSONObject(i);
  
              GetDataAdapter2.setImageTitleNamee(json.getString(JSON_IMAGE_TITLE_NAME));
  
              GetDataAdapter2.setImageServerUrl(json.getString(JSON_IMAGE_URL));
  
          } catch (JSONException e) {
  
              e.printStackTrace();
          }
          GetDataAdapter1.add(GetDataAdapter2);
      }
  
      recyclerViewadapter = new RecyclerViewAdapter(GetDataAdapter1, getContext());
  
      recyclerView.setAdapter(recyclerViewadapter);
  }
  
  @Override
  public void onAttach(Activity activity) {
      super.onAttach(activity);
  }
  
  @Override
  public void onDetach() {
      super.onDetach();
  }
  }
  
  
  RecyclerViewAdapter.java
  
  public class RecyclerViewAdapter extends RecyclerView.Adapter&lt;RecyclerViewAdapter.ViewHolder&gt; {
  Context context;
  List&lt;GetDataAdapter&gt; getDataAdapter;
  ImageLoader imageLoader1;
  public RecyclerViewAdapter(List&lt;GetDataAdapter&gt; getDataAdapter, Context context){
  
      super();
      this.getDataAdapter = getDataAdapter;
      this.context = context;
  }
  
  @Override
  public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
      View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.recyclerview_items, parent, false);
  
      ViewHolder viewHolder = new ViewHolder(v);
  
      return viewHolder;
  }
  @Override
  public void onBindViewHolder(ViewHolder Viewholder, int position) {
  
      GetDataAdapter getDataAdapter1 =  getDataAdapter.get(position);
  
      imageLoader1 = ServerImageParseAdapter.getInstance(context).getImageLoader();
  
      imageLoader1.get(getDataAdapter1.getImageServerUrl(),
              ImageLoader.getImageListener(
                      Viewholder.networkImageView,//Server Image
                      R.mipmap.ic_launcher,//Before loading server image the default showing image.
                      android.R.drawable.ic_dialog_alert //Error image if requested image dose not found on server.
              )
      );
  
  Viewholder.networkImageView.setImageUrl(getDataAdapter1.getImageServerUrl(), imageLoader1);
  
   Viewholder.ImageTitleNameView.setText(getDataAdapter1.getImageTitleName());
  
  }
  
  @Override
  public int getItemCount() {
  
      return getDataAdapter.size();
  }
  
  class ViewHolder extends RecyclerView.ViewHolder{
  
      public TextView ImageTitleNameView;
      public NetworkImageView networkImageView ;
  
      public ViewHolder(View itemView) {
  
          super(itemView);
  
          ImageTitleNameView = (TextView) itemView.findViewById(R.id.textView_item) ;
  
          networkImageView = (NetworkImageView) itemView.findViewById(R.id.VollyNetworkImageView1) ;
  
      }
  }
  }
  
  fragment_friends.xml
  
  &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:orientation="vertical"
  tools:context="com.ecom.fragment2.FriendsFragment"&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/recyclerview1"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" /&gt;
  
  &lt;/RelativeLayout&gt;
  
  
  
  recyclerview_items.xml
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.CardView
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:card_view="http://schemas.android.com/apk/res-auto"
  android:id="@+id/cardview1"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  card_view:cardElevation="3dp"
  card_view:contentPadding="3dp"
  card_view:cardCornerRadius="3dp"
  card_view:cardMaxElevation="3dp"
  &gt;
  
  
  &lt;RelativeLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;com.android.volley.toolbox.NetworkImageView
          android:id="@+id/VollyNetworkImageView1"
          android:layout_width="150dp"
          android:layout_height="100dp"
          android:src="@mipmap/ic_launcher"/&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:text="Image Name"
          android:id="@+id/textView_item"
          android:layout_centerVertical="true"
          android:layout_toRightOf="@+id/VollyNetworkImageView1"
          android:layout_toEndOf="@+id/VollyNetworkImageView1"
          android:layout_marginLeft="20dp"/&gt;
  
  &lt;/RelativeLayout&gt;
  
  &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>