Android studio cannot resolve method 'add(int,com.*...*.LoginFragment)
<p>Im trying to use Fragments on my app, but for some reason i get this error "cannot resolve method 'add(int,com.<em>...</em>.LoginFragment). i dont know what to do. i havce tried to import android.app.v4.... but its still giving me that error. </p>

<p><strong>this is the code</strong></p>

<pre><code>    import android.app.Activity;
    import android.app.Fragment;
    import android.app.FragmentManager
    import android.app.FragmentTransaction; 
    import android.content.Intent;
    import android.os.Bundle;
    import android.util.Log
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import com.google.android.gms.common.ConnectionResult;    
    import com.google.android.gms.common.GoogleApiAvailability; 


      public class TemplateLogReg extends Activity implements Connector {
      private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
      private static final String TAG = "Login";
      LoginFragment lg;
      EditText userTxt, passTxt;
      Button ret, reg, loginBtn, btnNewUser;
      private RegisterUser regUser;
      EditText phone, email, password;



     @Override
       protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         setContentView(R.layout.template_log_reg);
        if (checkPlayServices()) {
          // Start IntentService to register this application with GCM.
         Intent intent = new Intent(this, RegistrationIntentService.class);
          startService(intent);
      }


      reg = (Button) findViewById(R.id.regButton);
       phone = (EditText) findViewById(R.id.phoneEt);
       email = (EditText) findViewById(R.id.emailEt);
       password = (EditText) findViewById(R.id.passwordEt);
      ret = (Button) findViewById(R.id.ret);
      btnNewUser = (Button) findViewById(R.id.btnNewUser);
      userTxt = (EditText) findViewById(R.id.etPhone);
      passTxt = (EditText) findViewById(R.id.etPassword);
      loginBtn = (Button) findViewById(R.id.loginBtn);
      lg = new LoginFragment();
      lg.setInterface(this);

      /** this code show us the login page. 5 lines **/
       FragmentManager fm = getFragmentManager();
       FragmentTransaction ft = fm.beginTransaction();
       lg = new LoginFragment();
       lg.setInterface(this);
       ft.add(R.id.fragment_container, lg); // this line error
       ft.commit();
</code></pre>