title: I am checking the login process in fragment class so How to close the MainActivity When i move to the home after successfull login
body: <pre><code>package com.example.login;
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v7.app.ActionBarActivity;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  public class MainActivity extends ActionBarActivity {
      public static Sessions session;
      public static EditText userNameFiled;
      public static EditText passwordFiled;
      public static Button loginBtn;
      String status;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          session = new Sessions(getApplicationContext());
          //status=session.PrefloginCheck();
  
          if (session.PrefloginCheck()) {
              Intent i = new Intent(MainActivity.this, Home.class);
              startActivity(i);
              finish();
  
              Toast.makeText(getApplicationContext(),
                      "User Login Status From Main Activity: " + session.PrefloginCheck(),
                      Toast.LENGTH_SHORT).show();
          } 
  
  
          if (savedInstanceState == null) {
              getSupportFragmentManager().beginTransaction()
                      .add(R.id.container, new PlaceholderFragment()).commit();
          }
  
      }
  
      /**
       * A placeholder fragment containing a simple view.
       */
      public static class PlaceholderFragment extends Fragment implements
              View.OnClickListener {
  
  
          public PlaceholderFragment() {
          }
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                  Bundle savedInstanceState) {
              View rootView = inflater.inflate(R.layout.fragment_main, container,
                      false);
              userNameFiled = (EditText) rootView.findViewById(R.id.userName);
              passwordFiled = (EditText) rootView.findViewById(R.id.password);
              loginBtn = (Button) rootView.findViewById(R.id.loginButton);
              loginBtn.setOnClickListener(this);
              return rootView;
          }
  
          @Override
          public void onClick(View arg0) {
              session.createLoginSession("login", "true");
              session.createLoginSession("name", "uday");
              session.createLoginSession("email", "********@gmail.com");
              Intent i = new Intent(this.getActivity(), Home.class);
              startActivity(i);
  
              /*
               * When i triggered the login button i want to kill the login activity
               * */
              //finish();
          }
      }
  
  }
  </code></pre>
  
  <p><strong>strong text</strong></p>
  
  <p>I am checking the login process in fragment class so 
  How to close the MainActivity When i move to the home after successfull login.
  I am checking the login process in fragment class so 
  How to close the MainActivity When i move to the home after successfull login.</p>