黑妹日记属于你的个人日记本,提供日记添加车刊编辑,垃圾箱以及日记恢复
public class DiaryFragment extends Fragment { private ArrayList<Diary> diaries; Context context; public void initDiary(){ diaries = DatabaseCRUD.selectALL( context ); } @Override public View onCreateView( @NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { context = getContext(); View view = inflater.inflate( R.layout.content_main, container, false ); //读取数据库日记内容 initDiary(); RecyclerView diary_view = view.findViewById( R.id.diary_view ); LinearLayoutManager layoutManager = new LinearLayoutManager(context); diary_view.setLayoutManager(layoutManager); DiaryAdapter adapter= new DiaryAdapter(diaries); diary_view.setAdapter(adapter); return view; }}
评论