title: Starting MainActivity after Firebase Authentication
body: <p>I have already researched about how to start a new activity after a Login, but my app keeps crashing whenever I try to implement a new activity.   </p>
  
  <p>I got my launcher class Login Activity prompting for authentication via username-pw/Facebook/Google. </p>
  
  <p>Right now I am trying to start the new activity in the onActivityResult method, but keeps crashing. Tried different ways to start it, but right now Im lost. </p>
  
  <p>I managed to start a new fragment after clicking button, or start a new activity, but the login is giving me troubles.</p>
  
  <p>Thanks for your help - much appreciated!</p>
  
  <pre><code>public class LoginActivity extends AppCompatActivity implements View.OnClickListener{
      private static final int RC_SIGN_IN = 0;
      private FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login);
  
          //everything for firebase
          firebaseAuth = FirebaseAuth.getInstance();
          if (firebaseAuth.getCurrentUser() != null) {
              //user already signed in
              Log.d("AUTH", firebaseAuth.getCurrentUser().getEmail());
  
          } else {
              startActivityForResult(AuthUI.getInstance()
                              .createSignInIntentBuilder()
                              .setAvailableProviders(
                                      Arrays.asList(new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
                                              new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
                                              new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build()))
                              .build(),
                      RC_SIGN_IN);
          }
          findViewById(R.id.log_out_button).setOnClickListener(this);
      }
  
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode == RC_SIGN_IN) {
              if (resultCode == RESULT_OK) {
                  //user logged in
                  Log.d("AUTH", firebaseAuth.getCurrentUser().getEmail());
  
                  Uri contentUri = data.getData();
                  startActivity(new Intent(this, MainActivity.class)
                          .setData(contentUri));
  
                 // Intent myIntent = new Intent(LoginActivity.this, MainActivity.class);
                  // LoginActivity.this.startActivity(myIntent);
  
                  /* TEST: START RANDOM FRAGMENT FROM THE ACTIVITY
                  android.support.v4.app.FragmentManager fragmentManager = LoginActivity.this.getSupportFragmentManager();
                  android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
                  TrainingFragment trainingFragment = new TrainingFragment();
                  fragmentTransaction.add(R.id.fragment_container, trainingFragment);
                  fragmentTransaction.commit();*/
  
              }
              else {
                  //user not authenticated
                  Log.d("AUTH", "NOT AUTHENTICATED");
              }
          }
      }
  
  
      @Override
      public void onClick(View v) {
          if (v.getId() == R.id.log_out_button) {
              AuthUI.getInstance()
                      .signOut(this)
                      .addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
                          @Override
                          public void onComplete(@NonNull Task&lt;Void&gt; task) {
                                  Log.d("AUTH", "USER LOGGED OUT!");
                              //Fragment newFragment = new HomeFragment(); try to start new activity?
                              //switch to another fragment saying bye or some back next time or sth and then add a button with a "close app" function
                             /* android.support.v4.app.FragmentManager fragmentManager = LoginActivity.this.getSupportFragmentManager();
                              android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
                              TrainingFragment trainingFragment = new TrainingFragment();
                              fragmentTransaction.add(R.id.fragment_container, trainingFragment);
                              fragmentTransaction.commit(); */
                             finish(); //finish ends not only the activity, but the application, without it, the switch from activity to fragment functions :)
  
  
                          }
                      });
          }
      }
  }
  </code></pre>
  
  <p>ERROR LOG</p>
  
  <p>D/AndroidRuntime: Shutting down VM
  E/AndroidRuntime: FATAL EXCEPTION: main
                    Process: com.example.vreeni.firebaseauthentiction, PID: 28367
                    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.vreeni.firebaseauthentiction/com.example.vreeni.firebaseauthentication.MainActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2822)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897)
                        at android.app.ActivityThread.-wrap11(Unknown Source:0)
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598)
                        at android.os.Handler.dispatchMessage(Handler.java:105)
                        at android.os.Looper.loop(Looper.java:251)
                        at android.app.ActivityThread.main(ActivityThread.java:6563)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                     Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
                        at android.support.v7.app.AppCompatDelegateImplV9.setSupportActionBar(AppCompatDelegateImplV9.java:201)
                        at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:129)
                        at com.example.vreeni.firebaseauthentication.MainActivity.onCreate(MainActivity.java:26)
                        at android.app.Activity.performCreate(Activity.java:6975)
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2775)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897) 
                        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598) 
                        at android.os.Handler.dispatchMessage(Handler.java:105) 
                        at android.os.Looper.loop(Looper.java:251) 
                        at android.app.ActivityThread.main(ActivityThread.java:6563) 
                        at java.lang.reflect.Method.invoke(Native Method) 
                        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) </p>