title: Unable to destroy activity: java.lang.IllegalArgumentException: No view found for id () for fragment
body: <p>I have an activity <code>YYYY</code> (which inflates a fragment) that extends a base activity <code>XXXX</code> which in turn extends <code>ActionBarActivity</code>.
  I now call <code>finish()</code> in <code>onCreate()</code> method of <code>XXXX</code> (at the very top), based on some condition. 
  But I get the exception below. Kindly help me out.</p>
  
  <p>PS: I call <code>return;</code> after the <code>finish();</code> so that the rest of the <code>onCreate()</code> is not executed.</p>
  
  <pre><code>07-26 16:46:26.902  14569-14569/E/AndroidRuntime﹕ FATAL EXCEPTION: main
  java.lang.RuntimeException: Unable to destroy activity {XXXXXXXXXXXXXX}: java.lang.IllegalArgumentException: No view found for id 0x7f0c01ec (XXXXXXXX) for fragment XXXXXXXXXXXXXX{2c85cf32 #2 id=0x7f0c01ec}
      at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3758)
      at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3776)
      at android.app.ActivityThread.access$1400(ActivityThread.java:148)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:135)
      at android.app.ActivityThread.main(ActivityThread.java:5312)
      at java.lang.reflect.Method.invoke(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:372)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
  Caused by: java.lang.IllegalArgumentException: No view found for id 0x7f0c01ec (XXXXXXXXXXX) for fragment XXXXXXXXXXXXXXX{2c85cf32 #2 id=0x7f0c01ec}
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:945)
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1136)
      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1499)
      at android.support.v4.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:1963)
      at android.support.v4.app.FragmentActivity.onDestroy(FragmentActivity.java:313)
      at android.support.v7.app.ActionBarActivity.onDestroy(ActionBarActivity.java:166)
      at XXXXXXXXXXXXXXXXXXX.onDestroy(XXXXXXXXXXXX.java:100)
      at android.app.Activity.performDestroy(Activity.java:6132)
      at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1163)
      at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3745)
      at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3776)
      at android.app.ActivityThread.access$1400(ActivityThread.java:148)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:135)
      at android.app.ActivityThread.main(ActivityThread.java:5312)
      at java.lang.reflect.Method.invoke(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:372)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
  </code></pre>