-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
충남대 Android_김재민 2주차 1단계 과제 제출 #20
base: kjamm
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SELECT 쿼리를 배우셨는지 궁금하네요
데이터가 잘 들어갔는지 확인하기 위해서 데이터 저장후 SELECT 쿼리등을 이용해서 확인을 해도 좋을 것 같습니다.
val dbHelper = DatabaseHelper.getInstance(this) | ||
val db = dbHelper.writableDatabase | ||
|
||
db.execSQL("CREATE TABLE IF NOT EXISTS ${DatabaseHelper.TABLE_NAME} (" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Helper에 onCreate에서 이미 생성해주고 있어서 Create는 여기서 필요 없을 것 같네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵. 삭제하도록 하겠습니다. 감사합니다!
"${DatabaseHelper.COLUMN_NAME} TEXT, " + | ||
"${DatabaseHelper.COLUMN_ADDRESS} TEXT)") | ||
|
||
for (i in 1..10) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 되면 같은데이터가 10 개씩 들어가고 앱이 실행할떄마다 또 똑같은데이터가 10개씩 들어 갈 것 같은데요
이거 외에도 중복문제가 있나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아니요. 해당 원인 때문에 똑같은 데이터가 또 들어간 것 같습니다. 감사합니다!
|
||
recyclerView.layoutManager = LinearLayoutManager(this) | ||
|
||
val dbHelper = DatabaseHelper.getInstance(this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repository 클래스를 만들고 거기서 dbHelper와
"INSERT INTO ${DatabaseHelper.TABLE_NAME} (${DatabaseHelper.COLUMN_NAME}, ${DatabaseHelper.COLUMN_ADDRESS}) VALUES ('cafe$i', '대전 유성구 봉명동 $i')"
이러한 SQL동작들도 함수로 따로 뺴서 사용하면 훨씬 좋을 것 같네요
같은 insert기능인데 중복인 코드가 많이 보입니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 따로 만들도록 하겠습니다. 감사합니다!
그리고 아직 mvvm은 적용 안하신거죠? |
넵 처음 들어보는 개념이라 아직 공부중이기도 하고 신경쓰지 못했습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
코드 작성하면서 어려웠던 점
중점적으로 리뷰해주셨으면 하는 부분
실행화면