Created
April 9, 2018 18:59
-
-
Save codingpizza/448a70c1910f9580ebe6f007d4d5532c to your computer and use it in GitHub Desktop.
MainActivity con fragments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package codingpizza.com.cda7; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
public class MainActivity extends AppCompatActivity implements LoginFragment.onSignUpSelectedListener { | |
private FragmentManager mFragmentManager; | |
private LoginFragment mLoginFragment; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
mLoginFragment = new LoginFragment(); | |
mFragmentManager = getSupportFragmentManager(); | |
mFragmentManager.beginTransaction() | |
.add(R.id.fragment_container, mLoginFragment) | |
.commit(); | |
} | |
@Override | |
public void onSignUpSelected() { | |
SignInFragment signInFragment = new SignInFragment(); | |
mFragmentManager.beginTransaction() | |
.replace(R.id.fragment_container, signInFragment) | |
.commit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment