 <p>Removing the layout is not a solution.</p> <p>As you are only removing the layout defined by you. One of the indirect Superclass of MainActivity defines a default layout that get inflated when you call <code>super.onCreate(...)</code>. Basically it remove child views defined by you in layout.</p> <p>To avoid the activity from loading you need to remove its declaration the <code>AndroidManifest.xml</code>. The activity will not loaded than.</p> <pre><code>&lt;activity android:name=".MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre> <p>But to successfully run the app there should be at least one main activity with the <code>intent-filter</code> defined by above code otherwise Andorid system can not start your application.</p> <p>or</p> <p>You can create another activity in your application and change the name of <code>MainActivity</code> in <code>AndroidManifest.xml</code></p> <p>Hope it helps.</p>