Fragments in AppCompatActivity
<p>Could I use this extension if I want to use Fragments in my swipe view activity?</p>

<pre><code>public class Overview_Screen extends AppCompatActivity {
</code></pre>

<p>My Fragment classes use this one:</p>

<pre><code>public class MessagesFragmentPortrait extends android.support.v4.app.Fragment {
</code></pre>

<p>I am asking this because my app keeps crashing...<br>
Here is my main Activity:</p>

<pre><code>public class Overview_Screen extends AppCompatActivity {

    private SectionsPagerAdapter mSectionsPagerAdapter;

    private ViewPager mViewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_overview_screen);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
        mViewPager = (ViewPager) findViewById(R.id.container);
        mViewPager.setAdapter(mSectionsPagerAdapter);

        TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
        tabLayout.setupWithViewPager(mViewPager);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_overview_screen, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();

        if (id == R.id.action_settings) {
            Intent settings_intent = new Intent(this, Settings_Screen.class);
            startActivity(settings_intent);
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    public static class SectionsPagerAdapter extends FragmentPagerAdapter {

        public SectionsPagerAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int i) {
            switch (i) {
                case 0:
                    return new AccountFragmentPortrait();
                case 1:
                    return new FeedFragmentPortrait();
                default:
                    return new MessagesFragmentPortrait();
            }
        }

        @Override
        public int getCount() {
            return 3;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            switch (position) {
                case 0:
                    return "Account";
                case 1:
                    return "Feed";
                case 2:
                    return "Messages";
            }
            return null;
        }
    }
}
</code></pre>

<p>and here is my stack trace:</p>

<pre><code>FATAL EXCEPTION: main
  Process: de.lukas_schroederoutlook.connect, PID: 3364
  java.lang.RuntimeException: Unable to start activity ComponentInfo{de.lukas_schroederoutlook.connect/de.lukas_schroederoutlook.connect.Overview_Screen}:
  android.view.InflateException: Binary XML file line #41: Binary XML file line #41: Error inflating class fragment
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
      at android.app.ActivityThread.-wrap12(ActivityThread.java)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:154)
      at android.app.ActivityThread.main(ActivityThread.java:6119)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
   Caused by: android.view.InflateException: Binary XML file line #41: Binary XML file line #41: Error inflating class fragment
   Caused by: android.view.InflateException: Binary XML file line #41: Error inflating class fragment
   Caused by: java.lang.NullPointerException
      at java.lang.VMClassLoader.findLoadedClass(Native Method)
      at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      at android.support.v4.app.Fragment.isSupportFragmentClass(Fragment.java:469)
      at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2384)
      at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:120)
      at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:378)
      at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:33)
      at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:77)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
      at de.lukas_schroederoutlook.connect.Overview_Screen.onCreate(Overview_Screen.java:42)
      at android.app.Activity.performCreate(Activity.java:6679)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
      at android.app.ActivityThread.-wrap12(ActivityThread.java)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:154)
      at android.app.ActivityThread.main(ActivityThread.java:6119)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
</code></pre>

<p>And lastly, here is my overview screen xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="de.lukas_schroederoutlook.connect.Overview_Screen"&gt;

&lt;android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="@dimen/appbar_padding_top"
    android:theme="@style/AppTheme.AppBarOverlay"&gt;

    &lt;android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/AppTheme.PopupOverlay"&gt;

    &lt;/android.support.v7.widget.Toolbar&gt;

    &lt;android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" /&gt;

&lt;/android.support.design.widget.AppBarLayout&gt;

&lt;android.support.v4.view.ViewPager
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;

&lt;fragment
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/feed_fragment_portrait"/&gt;

&lt;fragment
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/feed_fragment_landscape"/&gt;
</code></pre>

<p></p>

<p>And my overview screen fragment xml:</p>

<pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="de.lukas_schroederoutlook.connect.Overview_Screen$PlaceholderFragment"&gt;

&lt;TextView
    android:id="@+id/section_label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" /&gt;
</code></pre>

<p></p>