안드로이드36 Kotlin] Custom 모델로 정의된 배열 저장하기 // sharedPreference ListViewItem으로 정의된 리스트뷰 아이템 배열을 저장하는 SharedPreferences 함수 만들기 1. gradle에 gson 추가해주고 implementation 'com.google.code.gson:gson:2.8.5' google/gson A Java serialization/deserialization library to convert Java Objects into JSON and back - google/gson github.com 2. 값 저장하는 함수 fun setStringArrayPref(key: String, values: ArrayList) { val gson = Gson() val json = gson.toJson(values) val prefs = getShared.. 2021. 3. 15. kotlin] 안드로이드 Custom Listview 만들기 간단 요약 : 원하는 custom 어댑터를 만들어서 리스트뷰에 붙인다. 1) 리스트뷰 아이템 커스텀 레이아웃을 만든다. 2) 리스트뷰 커스텀 어댑터를 만든다. 3) 리스튜 어댑터로 커스텀 어댑터를 지정한다. 1. 메인 엑티비티에 리스트뷰를 만들어줍니다. activity_main.xml 2. 커스텀 리스트뷰에 아이템에 적용될 xml을 만듭니다. item_listview.xml 3. 리스트뷰 아이템 정의를 위한 클래스를 만듭니다. // 리스트뷰 아이템 정의 class ListViewItem { var A : String? = null var B: String? = null } 4. item_listview이 적용된 리스트뷰의 어댑터를 정의합니다. 리스트에 값 추가하는 함수도 추가합니다. ListviewAda.. 2021. 3. 14. Kotlin] notifyDataSetChanged() 안될때 notifyDataSetChange not working from custom adapter When I repopulate my ListView, I call a specific method from my Adapter. Problem: When I call updateReceiptsList from my Adapter, the data is refreshed, but my ListView doesn't reflect the change... stackoverflow.com 아래와 같이 했더니 잘된다.. fun updateReceiptsList(newlist: ArrayList) { listViewItemList.clear() listViewItemList.addAll(newlist) this.noti.. 2021. 3. 8. 안드로이드 스튜디오] animateCamera, moveCamera 차이 What is the difference b/w animateCamera and moveCamera in google V2 maps? Hi guys while doing a sample project on android v2 maps for setting the current location. I came across couple of lines //what does this line do? mMap.moveCamera(CameraUpdateFactory.newLatLng(lat... stackoverflow.com animateCamera는 애니메이션 사용하기에 화면 전환이 부드럽고 moveCamera는 해당 화면으로 바로 이동. #animateCamera GoogleMap | Android용 Goog.. 2021. 2. 5. 이전 1 ··· 5 6 7 8 9 다음