์ ์ฒด ๊ธ (374) ์ธ๋ค์ผํ ๋ฆฌ์คํธํ [Android][Toast] Can't toast on a thread that has not called Looper.prepare() Crashlytics์์ ์ด์ ํด๋น ๋ฐ๊ฒฌ ๋ง์ด๋ ์ด์๋ก ๋ฑ์ฅํ๊ณ ์๋ค. (๊ณ ํ๋จํ๊ณ ์๋ค. ์ ๋ฐ ๋ง์ด๋ ์ด์์ฌ๋ผ...) ์ด์์ ๋ํ ์ค๋ช ๋ค https://stackoverflow.com/a/3875204 Can't create handler inside thread that has not called Looper.prepare() What does the following exception mean; how can I fix it? This is the code: Toast toast = Toast.makeText(mContext, "Something", Toast.LENGTH_SHORT); This is the exception: java.lang.RuntimeExce... stackoverflow... [Kotlin] Calendar extensions ๊ฐ๋จ val Calendar.year: Int get() = this.get(Calendar.YEAR) val Calendar.month: Int get() = this.get(Calendar.MONTH) val Calendar.day: Int get() = this.get(Calendar.DAY_OF_MONTH) val Calendar.dayOfWeek: Int get() = this.get(Calendar.DAY_OF_WEEK) [Kotlin] Selection Sort ์ง์ ํ ์๋ฆฌ์ ํ์ ๋ฒ์(๋น๊ต ๋์)์์ ์ฐพ์ ๋ง๋ ๊ฐ(๊ฐ์ฅ ์๊ฑฐ๋, ๊ฐ์ฅ ํฌ๊ฑฐ๋)์ ์ฐพ์ ๋ฃ๋๋ค. ๊ธฐ๋ณธ swap fun ArrayList.swap(firstIndex: Int, secondIndex: Int) { val temp = this[firstIndex] this[firstIndex] = this[secondIndex] this[secondIndex] = temp } Selection Sort fun ArrayList.selectionSort(showLog: Boolean = true) :ArrayList { if (this.size < 2) { println("๋ฐฐ์ด ํฌ๊ธฐ : ${this.size}. ๋ฐฐ์ด ๊ทธ๋๋ก ๋ฐํ") return this } for (currentPosition in 0 u.. [Android][Kotlin] ์ฌ์ฉ์๊ฐ ์ ํํ ํญ์ ๋ฌธ๊ตฌ์ ๋ณผ๋ ์ฒ๋ฆฌ ๊ธฐ๋ณธ Tab ๋ณผ๋ ์ฒ๋ฆฌ fun TabLayout.Tab.setBold() = this.view.children.find { it is TextView }?.let { tv -> (tv as TextView).post { tv.setTypeface(null, Typeface.BOLD) } } ๋ค๋ฅธ Typeface๋ก ๊ต์ฒด ๊ฐ๋ฅ https://developer.android.com/reference/android/graphics/Typeface#summary Typeface | Android Developers developer.android.com ์ ํ์ง๊ฐ 4๊ฐ์ง ๋ฐ์ ์๊ธฐ๋ ํ๋ค. ์ฌ์ฉ์๊ฐ ์ ํํ ํญ์ ๋ฌธ๊ตฌ ๋ณผ๋ ์ฒ๋ฆฌ fun TabLayout.setSelectedTabBold() = this.addOnTa.. [Kotlin] BaseUseCase abstract class UseCase where Type : Any { abstract suspend operator fun invoke(params: Params): Type? } [Android][Kotlin] ๋ฌธ๊ตฌ ๋ถ๋ถ ์ ๋ณ๊ฒฝ SpannedString ์ข ์ ํญ๋ชฉ ์ ์ธ build.gradle ์ implementation "androidx.core:core-ktx:$core_version" Utility fun String.targetColorSpan( emphasisString: String, @ColorInt colorRes: Int ): SpannedString { if(!this.contains(emphasisString)) return SpannedString(this) val splitStrings = this.split(emphasisString.toRegex()) return buildSpannedString { append(splitStrings[0]) color(colorRes) { append(emphasisString) } appe.. [Kotlin]Bubble Sort ์ธ์ ํ ๋ ๊ฐ์ ์์๋ค์ ๋น๊ตํ๋ฉฐ ์ ๋ ฌํ๋ค. ๊ธฐ๋ณธ swap fun ArrayList.swap(firstIndex: Int, secondIndex: Int) { val temp = this[firstIndex] this[firstIndex] = this[secondIndex] this[secondIndex] = temp } Bubble sort fun ArrayList.bubbleSort(showLog: Boolean = true) : ArrayList { if (this.size < 2) { println("๋ฐฐ์ด์ ํฌ๊ธฐ๊ฐ 2 ๋ฏธ๋ง. ๊ทธ๋๋ก ๋ฐํ.") return this } for (end in lastIndex downTo 1) { var swapped = false for(current in 0 un.. [Android][View] ๋ทฐ๊ฐ layout์ ์งํํ๋ ์ค์ requestLayout()์ ํธ์ถํ๋ฉด ์๋๋ค. https://www.youtube.com/watch?v=HbAeTGoKG6k ๋ฌด๋ ค 13๋ ์ ์ ์์. ๊ทธ๋ฌ๋ ์ง๊ธ๋ ์ค์ํ ๊ธฐ๋ณธ ์ง์์ผ๋ก ์์๋ ํ์๊ฐ ์๋ค๊ณ ์๊ฐํ๋ค. ์์ฝ ์งํํ ๋ฐ๋ชจ (์ด๋ ๊ฒ ํ๋ฉด ์๋ฉ๋๋ค. ๋์ ์์) 1. LinearLayout ์ ์์ํ Custom Layout์ด layout ๊ณผ์ ์ ์งํํ๋ ์ค์, ๊ทธ๋ฌ๋๊น onLayout()์ ํธ์ถํด ์คํํ๋ ์ค์ 2. ์๋ ๋ทฐ๋ฅผ add ํ๊ฑฐ๋(addView()) remove ํ๋ฉด(removeView()) 3. ๊ฒฐ๋ก : ์ด์๊ฐ ์๊ธด๋ค. > ์ผ์ข ์ ์ฌ๊ท๋ฌธ์ ๊ฐ ์๊ธด๋ค. layout ์ค : ์ผ๋ถ ํ์ ์งํฉ(์๋ ๋ทฐ๋ค)์ด๋ ์ ์ฒด ๋ทฐ ๊ณ์ธต ๊ตฌ์กฐ๋ฅผ ์ฌ๋ฐฐ์นํ๋ ์ค์ธ๋ฐ ์ด ํ์ด๋ฐ์ addView(), removeView() ํธ์ถ : ๋ ์ด์์ ์ ์ฒด์ ์ํฅ์.. ์ด์ 1 ยทยทยท 31 32 33 34 35 36 37 ยทยทยท 47 ๋ค์