title: Change between images using Fade In/Out animations
body: <p>I am trying to change between images using fade in/out and I am having a difficult time.</p>
  <p>This is what I have for the code</p>
  <pre><code>public void fade(View view)
      {
          ImageView loveLive = findViewById(R.id.lovelive);
          ImageView rikoCheer = findViewById(R.id.rikoCheer);
  
          loveLive.animate().alpha(0f).setDuration(2000);
          rikoCheer.animate().alpha(1f).setDuration(2000);
  
      }
  
      public void fade2(View view)
      {
          ImageView rikoCheer = findViewById(R.id.rikoCheer);
          ImageView loveLive = findViewById(R.id.lovelive);
  
          rikoCheer.animate().alpha(0f).setDuration(2000);
          loveLive.animate().alpha(1f).setDuration(2000);
  
  
      }
  </code></pre>
  <p>Here is my xml file</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/lovelive&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:onClick=&quot;fade&quot;
          app:srcCompat=&quot;@drawable/lovelive&quot;
          tools:layout_editor_absoluteX=&quot;50dp&quot;
          tools:layout_editor_absoluteY=&quot;-69dp&quot; /&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/rikoCheer&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:alpha=&quot;0&quot;
          android:onClick=&quot;fade&quot;
          app:srcCompat=&quot;@drawable/rikocheer&quot;
          tools:layout_editor_absoluteX=&quot;0dp&quot;
          tools:layout_editor_absoluteY=&quot;0dp&quot; /&gt;
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p>so my goal for this is to fade in and fade out between images</p>