我正在構建一個簡單的日志應用程序,用戶可以用它來做筆記。我正在嘗試從活動中的數據庫中獲取期刊列表。當我得到它時,它會顯示用戶輸入的整個筆記。我只想獲取第一行單詞,以便用戶可以單擊它以獲取完整注釋。這是我的代碼這是我將代碼保存到數據庫的地方 private void saveNoteToDB(View v) { Note note = new Note(); String newNotes = enterNotes.getText().toString(); note.setTheNotes(newNotes); //Save to Db db.addNotes(note); Snackbar.make(v, "Note Saved", Snackbar.LENGTH_LONG).show(); new Handler().postDelayed(new Runnable() { @Override public void run() { alertDialog.dismiss(); startActivity(new Intent(ListNotes.this, ListNotes.class)); } }, 1500);}這是我從數據庫中獲取項目的地方 //Get notes from Database noteItem = db.getAllNotes(); for (Note c : noteItem) { Note note = new Note(); note.setTheNotes(c.getTheNotes()); note.setId(c.getId()); note.setDateNotesAdded(c.getDateNotesAdded()); listItem.add(note); } recyclerViewAdapter = new RecyclerViewAdapter(this, listItem); recyclerView.setAdapter(recyclerViewAdapter); recyclerViewAdapter.notifyDataSetChanged();}
添加回答
舉報
0/150
提交
取消