Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package antonmatveyenka.testapp;
- import android.support.v4.app.FragmentTransaction;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- public class MainActivity extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- TestFragment fragment = new TestFragment();
- fragment.setMainActivity(this);
- ft.replace(R.id.container, fragment);
- ft.commit();
- }
- public void replaceFragment() {
- FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.replace(R.id.container, new TestFragmentSecond());
- ft.commit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement