mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-28 11:29:01 +03:00
Workaround for Crash on quick scroll
This commit is contained in:
parent
6f747eb939
commit
5a2f4b69e5
1 changed files with 10 additions and 10 deletions
|
@ -36,8 +36,9 @@ public class ItemAdapter extends ArrayAdapter<Item> {
|
||||||
}
|
}
|
||||||
SectionItem section = (SectionItem) item;
|
SectionItem section = (SectionItem) item;
|
||||||
TextView sectionTitle = (TextView) v.findViewById(R.id.sectionTitle);
|
TextView sectionTitle = (TextView) v.findViewById(R.id.sectionTitle);
|
||||||
sectionTitle.setText(section.geTitle());
|
if (sectionTitle != null) {
|
||||||
|
sectionTitle.setText(section.geTitle());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// first check to see if the view is null. if so, we have to inflate it.
|
// first check to see if the view is null. if so, we have to inflate it.
|
||||||
// to inflate it basically means to render, or show, the view.
|
// to inflate it basically means to render, or show, the view.
|
||||||
|
@ -56,16 +57,15 @@ public class ItemAdapter extends ArrayAdapter<Item> {
|
||||||
*/
|
*/
|
||||||
Note note = (Note) item;
|
Note note = (Note) item;
|
||||||
|
|
||||||
if (note != null) {
|
// This is how you obtain a reference to the TextViews.
|
||||||
|
// These TextViews are created in the XML files we defined.
|
||||||
|
|
||||||
// This is how you obtain a reference to the TextViews.
|
TextView noteTitle = (TextView) v.findViewById(R.id.noteTitle);
|
||||||
// These TextViews are created in the XML files we defined.
|
TextView noteExcerpt = (TextView) v
|
||||||
|
.findViewById(R.id.noteExcerpt);
|
||||||
TextView noteTitle = (TextView) v.findViewById(R.id.noteTitle);
|
TextView noteModified = (TextView) v.findViewById(R.id.noteModified);
|
||||||
TextView noteExcerpt = (TextView) v
|
|
||||||
.findViewById(R.id.noteExcerpt);
|
|
||||||
TextView noteModified = (TextView) v.findViewById(R.id.noteModified);
|
|
||||||
|
|
||||||
|
if (noteTitle != null) { //FIXME on quick scroll or moving to portrait mode the TextView seems to be null. This is only to prevent App Crashing
|
||||||
noteTitle.setText(note.getTitle());
|
noteTitle.setText(note.getTitle());
|
||||||
noteExcerpt.setText(note.getExcerpt());
|
noteExcerpt.setText(note.getExcerpt());
|
||||||
noteModified.setText(DateUtils.getRelativeDateTimeString(getContext(), note.getModified().getTimeInMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0));
|
noteModified.setText(DateUtils.getRelativeDateTimeString(getContext(), note.getModified().getTimeInMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0));
|
||||||
|
|
Loading…
Reference in a new issue