Kotlin33 Kotlin] 안드로이드 레이아웃을 이미지로 변환하기 레이아웃을 비트맵으로 변환합니다 뷰를 비트맵으로 변환하는 코드로 사용했는데 됐습니다; // 뷰를 비트맵으로 변환 fun viewToBitmap(view: View): Bitmap { val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888) val canvas = Canvas(bitmap) view.draw(canvas) return bitmap } viewToBitmap(frameLayout) [안드로이드 예제] Bitmap 이용해서 이미지 파일 원하는 크기로 자르기/늘리기(사진확대,축소) Bitmap 요즘 주말마다 한창 안드로이드 어플을하나 만들고 있습니다.저번 게시물에 관련 내용을 살짝 올렸... blog.na.. 2021. 3. 20. 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] 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. Kotlin] 안드로이드 스튜디오 AsyncTask ProgressDialog inner class ReadTask : AsyncTask() { val asyncDialog : ProgressDialog = ProgressDialog(this@MainActivity) override fun onPreExecute() { ....... asyncDialog.setProgressStyle(ProgressDialog.BUTTON_POSITIVE) asyncDialog.setMessage("지도 초기화 중...") asyncDialog.show() } .... override fun onPostExecute(result: String?) { // 종료 asyncDialog.dismiss() } } Use ProgressBar instead.. #참고 https://android--exam.. 2020. 8. 17. 이전 1 ··· 4 5 6 7 8 9 다음