Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Navigation Drawer abstraction
    text
    copied!<p>I know this question has been asked before (2 other i found similar) but they didnt address this side of the scenario! </p> <p>SO here's the scenario, I created a class as this:</p> <pre><code>public class BaseActivity extends ActionBarActivity { // Implemeted the Actionbar and navigation drawer here! // and it containts onCreate method and setContentView } </code></pre> <p>BaseActivity XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/base_nav_drawer" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;/LinearLayout&gt; &lt;ListView android:id="@+id/base_left_drawer" android:layout_width="320dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" android:background="#dddddd"/&gt; &lt;ListView android:id="@+id/base_right_drawer" android:layout_width="320dp" android:layout_height="match_parent" android:layout_gravity="end" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" android:background="#dddddd"/&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; </code></pre> <p>then extended my main class/activity from it:</p> <pre><code>public class Main extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } } </code></pre> <p>and here's Main activity XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:id="@+id/stream_new_layout" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hi dude"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>so now i can see the Actionbar and Navigation drawer in my Main activity, however, if i try to use <code>setContectView(R.layout.main)</code> on my Main activity to use the xml layout i created specific to this activity, the nav drawer will no show up anymore; i guess because <code>onCreate</code> and <code>setContectView</code> on Main activity, overrides the same statements from BaseActivity which i extended from. any solution for this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload