title: Shared Element Transition with RecyclerView items - Android
body: <p>I'm trying to make shared element transition work with an element inside a recycler view. When the user clicks on a textview inside my recycler view item, the Detail Activity opens. Inside Detail Activity, I display some infos and I also have a tab layout that loads some images from url using picasso. The transition to Detail Activity is working, but if the user returns to Main Activity before have loaded all images, the recycler view in Main Activity dissapers after the reverse animation! When I disable shared element transition, the problem is gone.</p>
  
  <p>Both activities work with fragments. So,  I'm trying to create a transition between two fragments, which are in different activities.</p>
  
  <p>In RecyclerViewAdapter, I set the transition name:</p>
  
  <pre><code>public void onBindViewHolder(final ViewHolder viewHolder, int position) {
    ... 
   viewHolder.profileImage.setTransitionName("profile"+position);
  </code></pre>
  
  <p>onClickListener of my textview (inside a fragment in Main Activity):</p>
  
  <pre><code>Intent i = new Intent(getCurrentActivity(), DetailActivity.class);
          ActivityOptionsCompat options = ActivityOptionsCompat.
                 makeSceneTransitionAnimation(getCurrentActivity(), (View) profileImage, "profile"+position);
          getCurrentActivity().startActivity(i, options.toBundle());
  </code></pre>
  
  <p>Inside the fragment of Detail Activity that has the shared element (in onCreateView):</p>
  
  <pre><code>profileImage.setTransitionName("profile"+position);
  </code></pre>
  
  <p>I already checked the transition name in both activities when the intent occurs and its the same.</p>
  
  <p>I'm stuck in this problem for two days and can't see what is happening. If you need more info or code about it, just ask.</p>
  
  <p>Thank you!</p>