title: How to pass live data with Intent
body: <p>How do you pass LiveData with intent to another Activity?</p>
  
  <p>I'm trying to pass the LiveData object into a new Activity that uses ViewPager 2 to display one object at a time. </p>
  
  <p>Here is Live data in the ViewModel</p>
  
  <pre><code>private LiveData&lt;List&lt;WrestlersEntity&gt;&gt; mWrestlersList;
  
  public LiveData&lt;List&lt;WrestlersEntity&gt;&gt; getWrestlersList() {
  return mWrestlersList;
  }
  </code></pre>
  
  <p>Fragment passing live data.</p>
  
  <pre><code>adapter.setOnItemClickListener(wrestler -&gt; {
      Bundle bundle = new Bundle();
      bundle.putSerializable("Value", (Serializable)mViewModel.getWrestlersList());
  
  
  Intent addEditIntent = new Intent(getActivity(), AddEditWrestlerActivity.class);
      addEditIntent.putExtras(bundle);
      startActivityForResult(addEditIntent);
  </code></pre>
  
  <p>Pager Activity</p>
  
  <pre><code>    Intent intent = this.getIntent();
      Bundle bundle = intent.getExtras();
      List&lt;WrestlersEntity&gt; wrestler (List&lt;WrestlersEntity&gt;)bundle.getSerializable("Value");
  </code></pre>
  
  <p>I get the following error.</p>
  
  <pre><code>java.lang.ClassCastException: androidx.room.RoomTrackingLiveData cannot be cast to java.io.Serializable
  </code></pre>
  
  <p>If you can't cast live data as Serializable what are my other options to pass a LiveData> to a new activity.</p>
  
  <p>here is a link to the git if you want to look at the full code.</p>
  
  <p><a href="https://github.com/Shawn-Nichol/Wrestlers" rel="nofollow noreferrer">https://github.com/Shawn-Nichol/Wrestlers</a></p>