title: Fatal Exception - java.lang.ClassCastException: android.widget.TextView
body: <p>I'm having an issue where I'm getting a fatal exception due to a class classcast exception. I've done a bit of research and found this:</p>
  
  <p><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ClassCastException.html" rel="nofollow">http://docs.oracle.com/javase/7/docs/api/java/lang/ClassCastException.html</a></p>
  
  <p>However it's my first time running into such an issue - and I'm not sure exactly how it can be resolved. </p>
  
  <pre><code>09-19 15:41:48.711: E/AndroidRuntime(430): FATAL EXCEPTION: main
  09-19 15:41:48.711: E/AndroidRuntime(430): java.lang.ClassCastException: android.widget.TextView
  09-19 15:41:48.711: E/AndroidRuntime(430):  at com.project.example.ssettings.UpdateActivity$NetworkTask.setProgressImgView(UpdateActivity.java:365)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at com.project.example.ssettings.UpdateActivity$NetworkTask.onProgressUpdate(UpdateActivity.java:352)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at com.project.example.ssettings.UpdateActivity$NetworkTask.onProgressUpdate(UpdateActivity.java:1)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:432)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at android.os.Handler.dispatchMessage(Handler.java:99)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at android.os.Looper.loop(Looper.java:123)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at android.app.ActivityThread.main(ActivityThread.java:3683)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at java.lang.reflect.Method.invokeNative(Native Method)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at java.lang.reflect.Method.invoke(Method.java:507)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  09-19 15:41:48.711: E/AndroidRuntime(430):  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>    @Override
          protected void onProgressUpdate(Integer... progress) {
              // Call function to update image view
              setProgressImgView(progress[0], progress[1], progress[2],
                      progress[3], progress[4]);
          }
  
          private void setProgressImgView(Integer imgViewId1, Integer imgViewId2,
                  Integer imgViewId3, Integer imgViewId4, Integer imgViewId5) {
              // update image view with the updating dots
              // Reset view layout in case orientation while updating
              setContentView(R.layout.updating);
              mProgressImageview1 = (ImageView) findViewById(R.id.loading_empty1);
              mProgressImageview2 = (ImageView) findViewById(R.id.loading_empty2);
              mProgressImageview3 = (ImageView) findViewById(R.id.loading_empty3);
              mProgressImageview4 = (ImageView) findViewById(R.id.loading_empty4);
              mProgressImageview5 = (ImageView) findViewById(R.id.loading_empty5);
              mProgressImageview1.setImageResource(imgViewId1);
              mProgressImageview2.setImageResource(imgViewId2);
              mProgressImageview3.setImageResource(imgViewId3);
              mProgressImageview4.setImageResource(imgViewId4);
              mProgressImageview5.setImageResource(imgViewId5);
  
          }
  </code></pre>