From aaf4264f441352d8e433adfec012305a5cbacce2 Mon Sep 17 00:00:00 2001 From: nero Date: Mon, 18 Dec 2023 16:13:35 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BB=AE=E3=81=AE=E7=94=BB=E9=9D=A2=E3=81=AF?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=81=9F=E3=81=8C=E3=80=81=E5=AE=9F=E8=A1=8C?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=A8=E3=82=A2=E3=83=97=E3=83=AA=E3=81=8C?= =?UTF-8?q?=E8=90=BD=E3=81=A1=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/library/LibraryTopFragment.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java index 495b235d..04000cd6 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java @@ -7,6 +7,11 @@ import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ListView; + +import java.util.ArrayList; +import java.util.List; /** * A simple {@link Fragment} subclass. @@ -59,6 +64,25 @@ public class LibraryTopFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_library_top, container, false); - } + View view = inflater.inflate(R.layout.fragment_library_top, container, false); + + // Use view.findViewById instead of findViewById + ListView documentListView = view.findViewById(R.id.document_list); + List documentList = new ArrayList<>(); + + documentList.add("Document A"); + documentList.add("Document B"); + documentList.add("Document C"); + + // レイアウトリソースを指定する(例: simple_list_item_1) + ArrayAdapter adapter = new ArrayAdapter<>( + requireActivity(), // 使用するActivityに依存する場合は requireActivity() を使う + android.R.layout.simple_list_item_1, + documentList); + + documentListView.setAdapter(adapter); + + return view; + } + } \ No newline at end of file