title: How to replace Android image drawable (glide) with a Lottie animation?
body: <p>I wanted to replace these three states WiFi images sequence (connect, connecting, connected) with one Lottie animation containing the 3 states:</p>
  <ol>
  <li>When it's <strong>idle</strong>, it should display a still frame from the WiFi Lottie animation.</li>
  <li>When a button is <strong>pressed</strong>: it plays the WiFi Lottie animation from frame x to frame y.</li>
  <li>When it <strong>connects</strong>: it displays a still frame from the WiFi Lottie animation.</li>
  </ol>
  <p>This is the Java code I need to modify:</p>
  <pre><code>protected void loadIcon() {
      if (state == WifiState.IDLE) {
          Glide.with(this).load(R.drawable.ic_connect).into(connectButtonTextView);
          Glide.with(this).load(R.drawable.ic_connect).into(connectButtonTextView);
  
      } else if (state == WifiState.CONNECTING_WIFI || state == WifiState.CONNECTING_CREDENTIALS) {
          connectButtonTextView.setVisibility(View.VISIBLE);
          Glide.with(this).load(R.drawable.is_connecting).into(connectButtonTextView);
          
      } else if (state == WifiState.CONNECTED) {
          Glide.with(this).load(R.drawable.ic_connected).into(connectButtonTextView);
          Glide.with(this).load(R.drawable.ic_connected).into(connectButtonTextView);
          connectButtonTextView.setVisibility(View.VISIBLE);
  
      }
  }
  </code></pre>