title: Fragment cannot be cast to android.app.Activity (private case)
body: <p>Good day! Please help me specifically with my case. I've read about the solution to this problem, but I don't see how to apply it to myself.</p>
  
  <blockquote>
    <p>07-13 18:55:28.339 3850-3850/com.zheil.zodiac E/AndroidRuntime: FATAL EXCEPTION: main
        Process: com.zheil.zodiac, PID: 3850
        java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.zheil.zodiac/com.zheil.zodiac.FirstFragment}:
    java.lang.ClassCastException: com.zheil.zodiac.FirstFragment cannot be
    cast to android.app.Activity
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2608)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
            at android.app.ActivityThread.-wrap12(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1514)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:163)
            at android.app.ActivityThread.main(ActivityThread.java:6221)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
         Caused by: java.lang.ClassCastException: com.zheil.zodiac.FirstFragment cannot be cast to android.app.Activity
            at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2598)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767) 
            at android.app.ActivityThread.-wrap12(ActivityThread.java) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1514) 
            at android.os.Handler.dispatchMessage(Handler.java:102) 
            at android.os.Looper.loop(Looper.java:163) 
            at android.app.ActivityThread.main(ActivityThread.java:6221) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)</p>
  </blockquote>
  
  <p>Fragment:</p>
  
  <pre><code>package com.zheil.zodiac;
  
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  public class FirstFragment extends Fragment {
      private TextView textView2;
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_first, container, false);
          textView2 = (TextView) view.findViewById(R.id.textView2);
          String textFromActivity = getArguments().getString("1");
          textView2.setText(textFromActivity);
  
          return view;
      }
  }
  </code></pre>
  
  <p>part of the code the main activity:</p>
  
  <pre><code>    @SuppressWarnings("StatementWithEmptyBody")
      @Override
      public boolean onNavigationItemSelected(MenuItem item) {
          // Создадим новый фрагмент
          Fragment fragment = null;
          Class fragmentClass = null;
  
          // Handle navigation view item clicks here.
          int id = item.getItemId();
  
          switch (id) {
              case R.id.nav_camera:
                  // Handle the camera action
                  fragmentClass = FirstFragment.class;
                  break;
              case R.id.nav_gallery:
                  fragmentClass = SecondFragment.class;
                  break;
              case R.id.nav_slideshow:
  
                  break;
              case R.id.nav_manage:
  
                  break;
              case R.id.nav_share:
  
                  break;
          }
  
          try {
              assert fragmentClass != null;
              fragment = (Fragment) fragmentClass.newInstance();
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          // Вставляем фрагмент, заменяя текущий фрагмент
          FragmentManager fragmentManager = getSupportFragmentManager();
          fragmentManager.beginTransaction().replace(R.id.container, fragment).commit();
          // Выделяем выбранный пункт меню в шторке
          item.setChecked(true);
          // Выводим выбранный пункт в заголовке
          setTitle(item.getTitle());
  
          Bundle bundle = new Bundle();
          bundle.putString("1", String.valueOf(getMapLastIntent().get("aries")));
          fragment.setArguments(bundle);
  
          DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          drawer.closeDrawer(GravityCompat.START);
          return true;
      }
  }
  </code></pre>