package com.example.jelica.fragments;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        FirstFragment firstFragment = new FirstFragment();

        getSupportFragmentManager().
                beginTransaction().
                add(R.id.framelayout, firstFragment).
                commit();
    }

    public void changeFragments(View view){
        SecondFragment second = new SecondFragment();

        getSupportFragmentManager().
                beginTransaction().
                replace(R.id.framelayout, second).
                commit();
    }
}
