From 9d108212dd3f43a3aa4528a69e08e2c67a040c65 Mon Sep 17 00:00:00 2001 From: nero Date: Wed, 20 Dec 2023 12:52:24 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=87=E3=83=BC=E3=82=BF=E3=82=92=E5=8F=96?= =?UTF-8?q?=E5=BE=97=E3=81=99=E3=82=8B=E3=81=9F=E3=82=81=E3=81=AE=E6=A9=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/library/LibraryXFragment.java | 22 +++++++++++++++++-- .../main/res/layout/fragment_library_file.xml | 17 ++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 feature/library/src/main/res/layout/fragment_library_file.xml diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryXFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryXFragment.java index 2205efa9..ebdc0a3e 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryXFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryXFragment.java @@ -1,11 +1,26 @@ package one.nem.lacerta.feature.library; import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + import androidx.fragment.app.Fragment; public class LibraryXFragment extends Fragment { - // フラグメントが作成された際に呼ばれるメソッド + private TextView textView; // フィールドとして TextView を定義 + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_library_file, container, false); + + textView = view.findViewById(R.id.textView); + + return view; + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -14,7 +29,10 @@ public class LibraryXFragment extends Fragment { if (getArguments() != null) { String receivedData = getArguments().getString("key_name"); - // ここで receivedData を使って何か処理を行う + // onCreateView メソッドで取得した TextView にデータをセットする + if (textView != null) { + textView.setText(receivedData); + } } } diff --git a/feature/library/src/main/res/layout/fragment_library_file.xml b/feature/library/src/main/res/layout/fragment_library_file.xml new file mode 100644 index 00000000..973a133e --- /dev/null +++ b/feature/library/src/main/res/layout/fragment_library_file.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file