package jp.fkmsoft.fragmentlesson.page.main;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;
import butterknife.OnClick;
import jp.fkmsoft.fragmentlesson.R;

/**
 * メイン画面
 */
public class MainFragment extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View root = inflater.inflate(R.layout.fragment_main, container, false);

        ButterKnife.inject(this, root);

        return root;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();

        ButterKnife.reset(this);
    }

    @OnClick(R.id.button_my_list)
    void myListClicked() {
        // Lesson 4.
        // R.id.contentsに、MyListFragmentを張り付けよう
    }

    @OnClick(R.id.button_settings)
    void settingsClicked() {
        // Lesson 4.
        // R.id.contentsに、SettingsFragmentを張り付けよう
    }
}

@@ -149,16 +149,114 @@
 agment;%0A
+import android.support.v4.app.FragmentManager;%0Aimport android.support.v4.app.FragmentTransaction;%0A
 import a
@@ -984,37 +984,188 @@
  // Lesson 4
-.%0A        // 
+%E3%81%AE%E5%9B%9E%E7%AD%94%0A        FragmentManager manager = getChildFragmentManager();%0A        FragmentTransaction transaction = manager.beginTransaction();%0A%0A        transaction.replace(
 R.id.content
@@ -1165,18 +1165,22 @@
 contents
-%E3%81%AB%E3%80%81
+, new 
 MyListFr
@@ -1181,31 +1181,59 @@
 ListFragment
-%E3%82%92%E5%BC%B5%E3%82%8A%E4%BB%98%E3%81%91%E3%82%88%E3%81%86
+());%0A%0A        transaction.commit();
 %0A    %7D%0A%0A    
@@ -1315,21 +1315,172 @@
 on 4
-.%0A        // 
+%E3%81%AE%E5%9B%9E%E7%AD%94%0A        FragmentManager manager = getChildFragmentManager();%0A        FragmentTransaction transaction = manager.beginTransaction();%0A%0A        transaction.replace(
 R.id
@@ -1492,10 +1492,14 @@
 ents
-%E3%81%AB%E3%80%81
+, new 
 Sett
@@ -1514,15 +1514,43 @@
 ment
-%E3%82%92%E5%BC%B5%E3%82%8A%E4%BB%98%E3%81%91%E3%82%88%E3%81%86
+());%0A%0A        transaction.commit();
 %0A   

Add Lesson 4 answer