diff --git a/app/src/main/java/org/ntlab/irisclient/DrawingCardFragment.java b/app/src/main/java/org/ntlab/irisclient/DrawingCardFragment.java index c949eec..6bded86 100644 --- a/app/src/main/java/org/ntlab/irisclient/DrawingCardFragment.java +++ b/app/src/main/java/org/ntlab/irisclient/DrawingCardFragment.java @@ -3,28 +3,39 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; public class DrawingCardFragment extends Fragment { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + + // コンストラクタ + public static DrawingCardFragment newInstance(String str){ + // インスタンス生成 + DrawingCardFragment fragment = new DrawingCardFragment(); + return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - return inflater.inflate(R.layout.fragment_card_drawing, null); + return inflater.inflate(R.layout.fragment_card_drawing, container, false); } @Override - public void onActivityCreated (Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - } + public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); - @Override - public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + FragmentManager fragmentManager = getChildFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + fragmentTransaction.addToBackStack(null); + fragmentTransaction.replace(R.id.container, + DrawingCardFragment.newInstance("Fragment")); + fragmentTransaction.commit(); + } }