title: IllegalStateException Caused By Intent?
body: <p>I sometimes found java.lang.IllegalStateException in my application:</p>
  
  <pre><code>java.lang.RuntimeException: 
    at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2825)
    at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2886)
    at android.app.ActivityThread.-wrap12 (ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1623)
    at android.os.Handler.dispatchMessage (Handler.java:102)
    at android.os.Looper.loop (Looper.java:186)
    at android.app.ActivityThread.main (ActivityThread.java:6509)
    at java.lang.reflect.Method.invoke (Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:914)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:804)
  
  Caused by: java.lang.IllegalStateException: 
    at com.****.onCreate (***.kt:35) &lt;-- here is the Intent.getStringExtra(..)
    at android.app.Activity.performCreate (Activity.java:6992)
    at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1119)
    at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2778)
  </code></pre>
  
  <p>After i looked into it, this issue is caused by <strong>Intent.getStringExtra()</strong> with code as follows:</p>
  
  <pre><code>private lateinit var mArticle : ArticleModel
  private lateinit var mArticleImg : String
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_article_detail)
  
      val intent : Intent = this.intent;
      mArticleImg = intent.getStringExtra( "articleImg" ) &lt;-- here is where it crashed
      mArticle = intent.getParcelableExtra("data")
  }
  </code></pre>
  
  <p>Have tested this in many testing devices and could not reproduce this crash issue except when i looked into google crash report. What exactly is IllegalStateException and does this happen because of the intent return value?</p>