Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- MaterialButton
- 안드로이드
- 랜덤ID
- Dialog
- 안드로이드스튜디오
- 안드로이드 스튜디오
- BottomSheetDialog
- ROOM
- Imageview
- Android
- textview
- Activity
- Kotlin
- OutlinedButton
- 뷰바인딩
- 코틀린
- firebase
- FRAGMENT
- RealtimeDB
- lifecyclescope
- 팝업액티비티
- androidstudio
- EditText
- ButtonWithButton
- nav_graph
- 밑줄
- ViewModel
- button
- ArrayList
- firebasefunctions
Archives
- Today
- Total
안드로이드 앱 개발
데이터 읽기 본문
아래 코드는
Google Cloud Firestore에서 데이터를 읽어오기 기본 코드이다.
DocumentReference docRef = db.collection("cities").document("SF");
docRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document.exists()) {
Log.d("readCusData", "DocumentSnapshot data: " + document.getData());
} else {
Log.d("readCusData", "No such document");
}
} else {
Log.d("readCusData", "get failed with ", task.getException());
}
}
});