Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.learn.fragments;
- import android.app.Activity;
- import android.os.Bundle;
- import android.support.v4.app.Fragment;
- import android.support.v4.app.FragmentActivity;
- import android.support.v4.app.FragmentManager;
- import android.support.v4.app.FragmentTransaction;
- import android.view.LayoutInflater;
- import android.view.Menu;
- import android.view.View;
- import android.view.ViewGroup;
- public class MainActivity extends FragmentActivity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- FragmentA fragmentA = new FragmentA();
- FragmentTransaction transaction = getSupportFragmentManager()
- .beginTransaction();
- transaction.add(R.id.container_id, fragmentA);
- transaction.commit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement