title: Android RecyclerView strange endAllStagingAnimators error
body: <p>I have very strange problem with displaying item in <code>RecyclerView</code>. first of all it does not display items (strange <code>D/OpenGLRenderer: endAllStagingAnimators on 0x6dd9c400 (CardView) with handle 0x6861d090</code> appears - never happened before) and back button does not work (it appears but does not react). Ok lets start. I have some <code>Fragment</code> (here is that fragment with <code>RecyclerView</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/Fmats.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fmats.jpg" alt="enter image description here"></a></p>
  
  <p>I also have 1 identical fragment to that but one of them conatins as you can see <code>kitchen types</code> and second one has <code>meal types</code>. When I click on one of list items, in both cases action redirects me to new activity</p>
  
  <p>When I click on some of that items f.e first one, here it is what happen inside this <code>RecyclerView</code> adapter:</p>
  
  <pre><code>@Override
  public void onBindViewHolder(ViewHolder holder, int position) {
      KitchenTypeItem kitchenItem = kitchenItems.get(position);
      holder.kitchenTypeName.setText("Kuchnia " + kitchenItem.getKitchenName());
      holder.kitchenTypeImgThumbnail.setImageResource(kitchenItem.getKitchenThumbnail());
      holder.kitchenTypeDescription.setText(kitchenItem.getKitchenDescription());
  
      holder.setClickListener(new ItemClickListener() {
  
          @Override
          public void onClick(View view, int position) {
              KitchenTypeItem kitchenItem = kitchenItems.get(position);
  
              Intent intent = new Intent(context, RecipeActivity.class);
              intent.putExtra(TYPE_NAME, kitchenItem.getKitchenName());
              intent.putExtra(DISPLAY_TYPE, 0);
              context.startActivity(intent);
          }
  
      });
  }
  </code></pre>
  
  <p>When I press one of that items I send 2 parameters to new activity which are: <code>TYPE_NAME</code> - helps me to get know if I will be using newly opened activity to download data from server containing <code>kitchen types</code> recipes or <code>meal types</code> recipes and <code>DISPLAY_TYPE</code> - used to send request to MySQL database. This is some code from 2nd adapter (as you can almost identical):</p>
  
  <pre><code>        Intent intent = new Intent(context, RecipeActivity.class);
          intent.putExtra(TYPE_NAME, mealItem.getMealName());
          intent.putExtra(DISPLAY_TYPE, 1);
          context.startActivity(intent);
  </code></pre>
  
  <p>This is what I get inside newly opened activity:</p>
  
  <p><a href="https://i.stack.imgur.com/vioUj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vioUj.jpg" alt="enter image description here"></a></p>
  
  <p>As you can see nothing is displying despite the fact <code>RecipeAdapter</code> is made correctly I think:</p>
  
  <p>Here you have it's code:</p>
  
  <pre><code>public class RecipeAdapter extends RecyclerView.Adapter&lt;RecipeAdapter.ViewHolder&gt; {
  
      private static String TAG = RecipeAdapter.class.getSimpleName().toString();
  
      private Context context;
      private ArrayList&lt;RecipeItem&gt; recipeItems;
      private CoordinatorLayout coordinatorLayout;
  
      public RecipeAdapter(Context context, ArrayList&lt;RecipeItem&gt; recipeItems) {
          this.context = context;
          this.recipeItems = recipeItems;
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.recipe_item, parent,
                  false);
  
          return new ViewHolder(v);
      }
  
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
          RecipeItem recipeItem = recipeItems.get(position);
          Picasso.with(context).load(recipeItem.getRecipeImgThumbnailLink()).into(
                  holder.recipeItemImgThumbnail);
          holder.recipeItemTitle.setText(recipeItem.getRecipeTitle());
          holder.recipeItemKitchenMealType.setText("Kuchnia " + recipeItem.getRecipeKitchenType() +
                  ", " + recipeItem.getRecipeMealType());
          holder.recipeItemAddDate.setText(recipeItem.getRecipeAddDate());
          holder.recipeItemLikeCount.setText(recipeItem.getRecipeLikeCount());
          holder.setClickListener(new ItemClickListener2() {
  
              @Override
              public void onClick(View view, int position, boolean isLongClick) {
                  if (!isLongClick) {
                      // go to recipes site
                  } else {
                      RecipeItem recipeItem = recipeItems.get(position);
                      FragmentActivity fragmentActivity = (FragmentActivity)(context);
                      FragmentManager fragmentManager = fragmentActivity.getSupportFragmentManager();
                      RecipeAddDialogFragment recipeDialogFragment = new RecipeAddDialogFragment();
                      Log.d(TAG, "Ustawiono recipeUniqueId, coordinatorLayout oraz " +
                              "recipeDialogFragment w klasie RecipeAddDialogFragment");
                      recipeDialogFragment.setReferences(recipeItem.getRecipeUniqueID(),
                              coordinatorLayout, recipeDialogFragment);
  
                      Log.d(TAG, "Uruchamiam okno dialogowe RecipeAddDialogFragment");
                      recipeDialogFragment.show(fragmentManager, "recipeDialogFragment");
                  }
              }
  
          });
      }
  
      @Override
      public int getItemCount() {
          return recipeItems.size();
      }
  
      // Recipe Item Holder
      class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,
              View.OnLongClickListener {
  
          private ImageView recipeItemImgThumbnail;
          private TextView recipeItemTitle;
          private TextView recipeItemKitchenMealType;
          private TextView recipeItemAddDate;
          private TextView recipeItemLikeCount;
          private ItemClickListener2 clickListener2;
  
          public ViewHolder(View itemView) {
              super(itemView);
              recipeItemImgThumbnail = (ImageView) itemView.findViewById(
                      R.id.recipe_item_img_thumbnail);
              recipeItemTitle = (TextView) itemView.findViewById(R.id.recipe_item_title);
              recipeItemKitchenMealType = (TextView) itemView.findViewById(
                      R.id.recipe_item_kitchen_meal_type);
              recipeItemAddDate = (TextView) itemView.findViewById(R.id.recipe_item_add_date);
              recipeItemLikeCount = (TextView) itemView.findViewById(R.id.recipe_item_like_count);
  
              itemView.setOnClickListener(this);
              itemView.setOnLongClickListener(this);
          }
  
          public void setClickListener(ItemClickListener2 itemClickListener2) {
              this.clickListener2 = itemClickListener2;
          }
  
          @Override
          public void onClick(View view) {
              clickListener2.onClick(view, getAdapterPosition(), false);
          }
  
          @Override
          public boolean onLongClick(View view) {
              clickListener2.onClick(view, getAdapterPosition(), true);
  
              return true;
          }
      }
  
      public void setCoordinatorLayout(CoordinatorLayout coordinatorLayout) {
          this.coordinatorLayout = coordinatorLayout;
      }
  }
  </code></pre>
  
  <p>Here is XML file of that activity:</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:tools="http://schemas.android.com/tools"
      android:id="@+id/recipe_activity_coordinator_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context=".RecipeActivity"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/log_reg_background"
          android:orientation="vertical"&gt;
  
          &lt;!-- Toolbar --&gt;
          &lt;include
              android:id="@+id/toolbar"
              layout="@layout/tool_bar"
              android:layout_width="match_parent"
              android:layout_height="wrap_content" /&gt;
  
          &lt;android.support.v7.widget.RecyclerView
              android:id="@+id/activity_recipe_recyclerview"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:paddingBottom="8dp"
              android:clipToPadding="false"/&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>This is main code of the activity:</p>
  
  <pre><code>public class RecipeActivity extends AppCompatActivity {
  
      private static String TAG = RecipeActivity.class.getSimpleName().toString();
  
      private ArrayList&lt;RecipeItem&gt; recipeItems;
      private RecipeAdapter recipeAdapter;
      private ProgressDialog pDialog;
      private CoordinatorLayout coordinatorLayout;
      private BroadcastReceiver broadcastReceiver;
      private int offset;
  
      private String typeName;
      private int displayType;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_recipe);
  
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          getSupportActionBar().setDisplayShowHomeEnabled(true);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
          offset = 0;
  
          recipeItems = new ArrayList&lt;&gt;();
  
          coordinatorLayout = (CoordinatorLayout) findViewById(
                  R.id.recipe_activity_coordinator_layout);
  
          RecyclerView recipeRecyclerView  = (RecyclerView) findViewById(
                  R.id.activity_recipe_recyclerview);
  
          recipeAdapter = new RecipeAdapter(getApplicationContext(), recipeItems);
  
          recipeAdapter.setCoordinatorLayout(coordinatorLayout);
  
          recipeRecyclerView.setHasFixedSize(true);
          recipeRecyclerView.setAdapter(recipeAdapter);
          recipeRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
          recipeRecyclerView.setItemAnimator(new DefaultItemAnimator());
  
          getBundleExtras();  // Getting Argument Passed By Meal Or Kitchen Type Adapter
          setActivityTitle(); // Setting Title Depending On Adapter Type
  
          setBroadcastReceiver();
      }
  
      @Override
      public void onResume() {
          registerReceiver(broadcastReceiver, new IntentFilter(
                  "android.net.conn.CONNECTIVITY_CHANGE"));
          Log.d(TAG, "Zarejestrowano BroadcastReceiver'a");
          super.onResume();
      }
  
      @Override
      public void onPause() {
          unregisterReceiver(broadcastReceiver);
          Log.d(TAG, "Wyrejestrowano BradcasReceiver'a");
          super.onPause();
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.menu_main, menu);
  
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          int id = item.getItemId();
  
          if (id == R.id.home) {
              NavUtils.navigateUpFromSameTask(this);
  
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      private void getBundleExtras() {
          Bundle extras = getIntent().getExtras();
          // Static Fields Could Bo From MealAdapter Aswell
          typeName = extras.getString(KitchenTypeAdapter.TYPE_NAME);
          displayType = extras.getInt(KitchenTypeAdapter.DISPLAY_TYPE);
          Log.d(TAG, "Trzymano dane z listy fragmentu: typeName=" + typeName + ", displayType=" +
                  displayType);
      }
  
      private void setActivityTitle() {
          switch (displayType) {
              case 0: {
                  setTitle(getString(R.string.nav_kitchen_type));
                  Log.d(TAG, "Ustawiono tytuł: " + displayType);
                  break;
              }
              case 1: {
                  setTitle(getString(R.string.nav_meal_type));
                  Log.d(TAG, "Ustawiono tytuł: " + displayType);
                  break;
              }
          }
      }
  
      private void setBroadcastReceiver() {
          broadcastReceiver = new BroadcastReceiver() {
  
              @Override
              public void onReceive(Context context, Intent intent) {
                  ConnectivityManager cm = (ConnectivityManager) context.getSystemService(
                          Context.CONNECTIVITY_SERVICE);
                  NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
                  if (activeNetwork == null) {
                      Log.d(TAG, "Brak połączenia. Pokazuję komuikat.");
                      showSnackbarInfo(getString(R.string.err_msg_connection_problem),
                              R.color.snackbar_error_msg);
                  } else {
                      if (recipeItems.isEmpty()) {
                          Log.d(TAG, "Jest połączenie. Listy puste. Pobieram przepisy.");
                          getRecipes();
                      } else {
                          Log.d(TAG, "Jest połączenie. Listy pełne. Nic nie robię.");
                      }
                  }
              }
  
          };
      }
  
      private void getRecipes() {
          switch (displayType) {
              case 0: {
                  Log.d(TAG, "Pobieranie przepisów z warunkiem typ_kuchnii");
                  getKitchenTypeRecipes();
                  break;
              }
              case 1: {
                  Log.d(TAG, "Pobieranie przepisów z warunkiem typ_posiłku");
                  getMealTypeRecipes();
                  break;
              }
          }
      }
  
      private void getKitchenTypeRecipes() {
          JsonArrayRequest kitchenTypeRecipesReq = new JsonArrayRequest(prepareGetMethodUrl(),
                  new Response.Listener&lt;JSONArray&gt;() {
  
                      @Override
                      public void onResponse(JSONArray response) {
                          Log.d("odpowiedz", "Odpowiedź przepisów: " + response.toString());
                          Log.d("odpowiedz", "Dlugosc response: " + Integer.toString(
                                  response.length()));
                          if (response.length() == 0) {
                              showSnackbarInfo("Na serwerze nic nie ma (kitchen type)", R.color.snackbar_info_msg);
                          } else {
                              for (int i = 0; i &lt; response.length(); i++) {
                                  try {
                                      JSONObject jObj = response.getJSONObject(i);
                                      RecipeItem recipeItem = new RecipeItem();
                                      recipeItem.setRecipeUniqueID(jObj.getString("unique_id"));
                                      recipeItem.setRecipeTitle(jObj.getString("title"));
                                      recipeItem.setRecipeImgThumbnailLink(jObj.getString(
                                              "img_tumbnail_link"));
                                      recipeItem.setRecipeAddAte(jObj.getString("add_date"));
                                      recipeItem.setRecipeKitchenType(jObj.getString("kitchen_type"));
                                      recipeItem.setRecipeMealType(jObj.getString("meal_type"));
                                      recipeItem.setRecipeLikeCount(jObj.getString("like_count"));
  
                                  } catch (JSONException e) {
                                      e.printStackTrace();
                                  }
                              }
                              recipeAdapter.notifyItemRangeInserted(recipeItems.size(),
                                      response.length());
                          }
                      }
  
                  }, new Response.ErrorListener() {
  
                      @Override
                      public void onErrorResponse(VolleyError error) {
                          Log.e("odpowiedz", "Błąd pobierania przepisów (kichen type): " +
                                  Integer.toString(error.networkResponse.statusCode));
  
                          showSnackbarInfo(Integer.toString(error.networkResponse.statusCode),
                                  R.color.snackbar_error_msg);
                      }
  
                  });
          AppController.getInstance().addToRequestQueue(kitchenTypeRecipesReq);
      }
  
      private void getMealTypeRecipes() {
          JsonArrayRequest mealTypeRecipesReq = new JsonArrayRequest(prepareGetMethodUrl(),
                  new Response.Listener&lt;JSONArray&gt;() {
  
                      @Override
                      public void onResponse(JSONArray response) {
                          Log.d("odpowiedz", "Odpowiedź przepisów: " + response.toString());
                          Log.d("odpowiedz", "Dlugosc response: " + Integer.toString(
                                  response.length()));
                          if (response.length() == 0) {
                              showSnackbarInfo("Na serwerze nic nie ma (meal_type)",
                                      R.color.snackbar_info_msg);
                          } else {
                              for (int i = 0; i &lt; response.length(); i++) {
                                  try {
                                      JSONObject jObj = response.getJSONObject(i);
                                      RecipeItem recipeItem = new RecipeItem();
                                      recipeItem.setRecipeUniqueID(jObj.getString("unique_id"));
                                      recipeItem.setRecipeTitle(jObj.getString("title"));
                                      recipeItem.setRecipeImgThumbnailLink(jObj.getString(
                                              "img_tumbnail_link"));
                                      recipeItem.setRecipeAddAte(jObj.getString("add_date"));
                                      recipeItem.setRecipeKitchenType(jObj.getString("kitchen_type"));
                                      recipeItem.setRecipeMealType(jObj.getString("meal_type"));
                                      recipeItem.setRecipeLikeCount(jObj.getString("like_count"));
  
                                  } catch (JSONException e) {
                                      e.printStackTrace();
                                  }
                              }
                              recipeAdapter.notifyItemRangeInserted(recipeItems.size(),
                                      response.length());
                          }
                      }
  
                  }, new Response.ErrorListener() {
  
                      @Override
                      public void onErrorResponse(VolleyError error) {
                              Log.e("odpowiedz", "Błąd pobierania przepisów (meal type): " +
                                      Integer.toString(error.networkResponse.statusCode));
  
                          showSnackbarInfo(Integer.toString(error.networkResponse.statusCode),
                                  R.color.snackbar_error_msg);
                      }
  
                  });
          AppController.getInstance().addToRequestQueue(mealTypeRecipesReq);
      }
  
      private String prepareGetMethodUrl() {
          switch (displayType) {
              case 0: {
                  return AppConfig.URL_GETRECIPESBYKITCHENTYPE + "?kitchen_type=" + typeName +
                          "&amp;offset=" + Integer.toString(offset);
              }
  
              case 1: {
                  return AppConfig.URL_GETRECIPESBYMEALTYPE + "?meal_type=" + typeName +
                          "&amp;offset=" + Integer.toString(offset);
              }
  
              default:
                  return null;
          }
      }
  
      // Showing Dialog Window
      private void showDialog() {
          if (!pDialog.isShowing()) {
              pDialog.show();
          }
      }
  
      // Hiding Dialog Window
      private void hideDialog() {
          if (pDialog.isShowing()) {
              pDialog.dismiss();
          }
      }
  
      // Fucntion Showing Text In Snackbar
      private void showSnackbarInfo(String info, int textColor) {
          Snackbar snackbar = Snackbar.make(coordinatorLayout, info, Snackbar.LENGTH_LONG);
  
          View sbView = snackbar.getView();
          TextView sbText = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text);
          sbText.setTextColor(ContextCompat.getColor(getApplicationContext(), textColor));
  
          snackbar.show();
      }
  }
  </code></pre>
  
  <p>I can guarantee that everything is fine with downloading and <code>putExtra</code> works fine so the parameters are send correctly. Just the problem with displaying it and that strange error: <code>D/OpenGLRenderer: endAllStagingAnimators on 0x6dd9c400 (CardView) with handle 0x6861d090</code> and not working <code>up button</code>. Can sb help me?</p>