발생한 오류는 다음과 같습니다.
1. layout 요소를 id 로 가져온후 BoardModel 에 get 함수로 텍스트를 넣어준다.
TextView tv_uid = (TextView) convertView.findViewById(R.id.tv_time);
tv_uid.setText(BoardModel.getUid());
2. BoardModel 의 멤버와 메서드들이 모두 static 으로 선언되어 있습니다.
public static String uid = "";
[ 해결 방법 ]
1. static 을 제거 후 모두 public 으로 선언해줍니다.
2. BoardModel.getUid() 와 같이 클래스에 직접 접근하지말고, 객체로 생성 후 접근해줍니다.
BoardModel boardModel;
TextView tv_uid = (TextView) convertView.findViewById(R.id.tv_time);
tv_uid.setText(boardModel.getUid());
-> 해결 완료
'안드로이드' 카테고리의 다른 글
User does not have permission to access this object (0) | 2022.09.06 |
---|---|
com.google.firebase.database.DatabaseException: Class com.example.recycler.models.BoardModel does not define a no-argument constructor (0) | 2022.09.06 |
Fragment (0) | 2022.08.23 |
One or more issues found when checking AAR metadata values: (0) | 2022.08.23 |