๐Ÿงฉ์•ˆ๋“œ๋กœ์ด๋“œ

    [Android/Kotlin] ํ‘ธ์‹œ ์•Œ๋ฆผ์ด ํŒ์—…์œผ๋กœ ๋œจ์ง€ ์•Š์„ ๋•Œ Notification won't show up as a heads up notification

    https://stackoverflow.com/questions/71482843/android-notification-wont-show-up-as-a-heads-up-notification Android notification won't show up as a heads up notification I am using the following code to show my notification: NotificationCompat.Builder builder = new NotificationCompat.Builder(context, context.getString(R.string. stackoverflow.com PRIORITY_HIGH, IMPORTANCE_HIGH๋ฅผ ์ ์šฉํ•ด๋„ ํŒ์—…์ด ๋œจ์ง€ ์•Š์•„์„œ ์‚ฝ์งˆ์„ ..

    [Android/Kotlin] Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE ...

    ์•ˆ๋“œ๋กœ์ด๋“œ 12๋กœ ๋„˜์–ด์˜ค๋ฉด์„œ ์ƒ๊ธด ๋ฌธ์ œ. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• 1 dependencies { implementation 'androidx.work:work-runtime-ktx:2.7.1' ... } ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• 2 val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_MUTABLE); PendingIntent๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ณณ์— PendingIntent.FLAG๋ฅผ ์„ค์ •ํ•ด์ค€๋‹ค. Android 12 ์ดํ›„ ๋ถ€ํ„ฐ ๋ฐ˜๋“œ์‹œ ์„ค์ •ํ•ด์•ผํ•œ๋‹ค. ์ €๋Š” 1๋ฒˆ์˜ ๋ฐฉ๋ฒ•์ด ์•ˆ๋˜์„œ 2๋ฒˆ ๋ฐฉ๋ฒ•์œผ๋กœ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค...!

    [Android/Kotlin] getString(), getColor(), getDrawable() ์‚ฌ์šฉ๋ฒ• (strings.xml, colors.xml, drawable.xml Resource ๊ฐ€์ ธ์˜ค๊ธฐ)

    getString() Activity, Fragment ์—์„œ getString(R.string.normal) ๊ทธ ์™ธ(BindingAdapter) @BindingAdapter("gradeColor") @JvmStatic fun setGradeColor(textView: TextView, grade: String) { textView.context.getString(R.string.good) ... getColor(), getDrawable() ContextCompat.getColor(mContext, R.color.custom_gray) ContextCompat.getDrawable(mContext, R.drawable.custom_bg)

    [Android/Kotlin] MVVM ํŒจํ„ด, AAC

    MVVM ํŒจํ„ด ์ •์˜ Model, View, ViewModel์˜ ์•ฝ์ž Model MVC์™€ ๋™์ผ ์ฃผ๋กœ DB ์‚ฌ์šฉ ๋˜๋Š” API ํ˜ธ์ถœ์„ ์˜๋ฏธ View Activity, Fragment (xml ํŒŒ์ผ + Activity, Fragment ํŒŒ์ผ) ์‚ฌ์šฉ์ž์˜ ์ž…๋ ฅ์„ ๋ฐ›์Œ ViewModel์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๊ด€์ฐฐํ•˜์—ฌ UI ๊ฐฑ์‹  ViewModel์˜ ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Œ UI ๋ณ€๊ฒฝ๊ณผ ๊ด€๋ จ๋œ ์‚ฌํ•ญ๋งŒ ์ฒ˜๋ฆฌ (Model์„ ์•Œ๋ฉด ์•ˆ ๋จ) ViewModel View๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉ์ž ์ž…๋ ฅ์„ ๋ฐ›์œผ๋ฉด Model์— ์•Œ๋งž์€ ๋ฐ์ดํ„ฐ ์š”์ฒญ Model์—์„œ ๋ฐ›์•„์˜จ ๋ฐ์ดํ„ฐ๋ฅผ ์•Œ๋งž๊ฒŒ ๊ฐ€๊ณตํ•˜์—ฌ ๊ฐ’ ๊ฐฑ์‹  View, Context์˜ ์กด์žฌ๋ฅผ ์•Œ๋ฉด ์•ˆ ๋จ MVVM ํŒจํ„ด์—์„œ View์™€ Model ์‚ฌ์ด์˜ ์˜์กด์„ฑ์ด ์กด์žฌํ•˜๋ฉด ์•ˆ ๋จ (View๋Š” ViewModel๋งŒ ๊ด€์ฐฐํ•˜๋Š”..

    [Android/Kotlin] MVP ํŒจํ„ด

    MVP ํŒจํ„ด MVC ํŒจํ„ด์ด ๋ญ”์ง€ ๋ชจ๋ฅธ๋‹ค๋ฉด ๋จผ์ € ์ด ๊ธ€์„ ๋ณด๊ณ  ์˜ค์ž! https://ku-hug.tistory.com/187 [Android/Kotlin] MVC ํŒจํ„ด MVC ํŒจํ„ด ๋””์ž์ธ ํŒจํ„ด์ด ๋ญ”์ง€ ๋ชจ๋ฅธ๋‹ค๋ฉด ๋จผ์ € ์ด ๊ธ€์„ ๋ณด๊ณ  ์˜ค์ž! https://ku-hug.tistory.com/181 MVC -> MVP -> MVVM ์ˆœ์„œ๋กœ ๊ณต๋ถ€ํ•˜๊ฒ ๋‹ค. ๋””์ž์ธ ํŒจํ„ด์ด๋ž€? ์‰ฝ๊ฒŒ ๋งํ•˜๋ฉด ๋””์ž์ธ ํŒจํ„ด = ๊ฒ€์ฆ" data-og-host="ku-hu.. ku-hug.tistory.com Model, View, Presenter์˜ ์•ฝ์ž Model MVC์˜ Model๊ณผ ๋™์ผ View MVC์˜ View + MVC์˜ Controller (= xml ํŒŒ์ผ๊ณผ Fragment, Activity ํŒŒ์ผ) ์‚ฌ์šฉ์ž์˜ ์ž…๋ ฅ์„ ๋ฐ›๊ณ  ์ด๋ฒคํŠธ๋ฅผ Pre..

    [Android/Kotlin] MVC ํŒจํ„ด

    MVC ํŒจํ„ด ๋””์ž์ธ ํŒจํ„ด์ด ๋ญ”์ง€ ๋ชจ๋ฅธ๋‹ค๋ฉด ๋จผ์ € ์ด ๊ธ€์„ ๋ณด๊ณ  ์˜ค์ž! https://ku-hug.tistory.com/181 [Android] ๋””์ž์ธ ํŒจํ„ด(์ฐธ๊ณ  ๋งํฌ ๋ชจ์Œ) ํ”„๋กœ์ ํŠธ์— MVVMํŒจํ„ด์„ ์ ์šฉํ•˜๊ณ  ์žˆ์œผ๋‚˜ ์ •ํ™•ํ•œ ๊ฐœ๋…์ด ์ˆ™์ง€๋˜์ง€ ์•Š์•„ ์ •๋ฆฌํ•ด๋ณด๋ ค ํ•œ๋‹ค. ์šฐ์„  ๋””์ž์ธ ํŒจํ„ด -> MVC -> MVP -> MVVM ์ˆœ์„œ๋กœ ๊ณต๋ถ€ํ•˜๊ฒ ๋‹ค. ๋””์ž์ธ ํŒจํ„ด์ด๋ž€? ์‰ฝ๊ฒŒ ๋งํ•˜๋ฉด ๋””์ž์ธ ํŒจํ„ด = ๊ฒ€์ฆ ku-hug.tistory.com Model, View, Controller์˜ ์•ฝ์ž. Model ์ถœ๋ ฅํ•  ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ–๊ณ  ๊ฐ์ข… ์ฒ˜๋ฆฌ๋ฅผ ํ•œ๋‹ค. (๋ฐ์ดํ„ฐ ๊ฐ€๊ณต, ์ถ”๊ฐ€, ์‚ญ์ œ) View ๋ฐ์ดํ„ฐ๋ฅผ ์‹œ๊ฐํ™”ํ•œ ๋ถ€๋ถ„ ๋ชจ๋ธ์ด ์ฒ˜๋ฆฌํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉ ๋ณด์—ฌ์ฃผ๋Š” ๊ธฐ๋Šฅ๋งŒ ๋‹ด๋‹น (๋กœ์ง์ด๋‚˜ ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด๊ฐ€๋ฉด ์•ˆ๋จ) Controller ์‚ฌ์šฉ์ž์˜ ์š”์ฒญ์„ ์ฒ˜..

    [Android] ๋””์ž์ธ ํŒจํ„ด(์ฐธ๊ณ  ๋งํฌ ๋ชจ์Œ)

    ํ”„๋กœ์ ํŠธ์— MVVMํŒจํ„ด์„ ์ ์šฉํ•˜๊ณ  ์žˆ์œผ๋‚˜ ์ •ํ™•ํ•œ ๊ฐœ๋…์ด ์ˆ™์ง€๋˜์ง€ ์•Š์•„ ์ •๋ฆฌํ•ด๋ณด๋ ค ํ•œ๋‹ค. ์šฐ์„  ๋””์ž์ธ ํŒจํ„ด -> MVC -> MVP -> MVVM ์ˆœ์„œ๋กœ ๊ณต๋ถ€ํ•˜๊ฒ ๋‹ค. ๋””์ž์ธ ํŒจํ„ด์ด๋ž€? ์‰ฝ๊ฒŒ ๋งํ•˜๋ฉด ๋””์ž์ธ ํŒจํ„ด = ๊ฒ€์ฆ๋œ ์†Œํ”„ํŠธ์›จ์–ด ๊ฐœ๋ฐœ ์„ค๊ณ„ ๋ฐฉ๋ฒ•์ธ ๊ฒƒ ๊ฐ™๋‹ค. ์•ˆ๋“œ๋กœ์ด๋“œ ์•ฑ์„ ์„ค๊ณ„ํ•  ๋•Œ ๋””์ž์ธ ํŒจํ„ด์„ ์ ์šฉ ์ด๋ฏธ ๊ฒ€์ฆ๋œ ํŒจํ„ด์ด๋ฏ€๋กœ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ผ์ด ์ ๋‹ค. ์ •ํ˜•ํ™”๋œ ํŒจํ„ด์ด๋ฏ€๋กœ ๊ฐœ๋ฐœ์ž ๊ฐ„์˜ ์˜์‚ฌ์†Œํ†ต์ด ์ˆ˜์›”ํ•ด์ง„๋‹ค. ๋” ์œ ์—ฐํ•˜๊ณ  ์ข‹์€ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ๋””์ž์ธ ํŒจํ„ด์€ ํฌ๊ฒŒ 3์ข…๋ฅ˜๋กœ ๋‚˜๋‰œ๋‹ค. ์ƒ์„ฑ ํŒจํ„ด ๊ตฌ์กฐ ํŒจํ„ด ํ–‰์œ„ ํŒจํ„ด ์ƒ์„ฑ ํŒจํ„ด 1. ์ถ”์ƒ ํŒฉํ† ๋ฆฌ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ™œ์šฉํ•˜๋Š” ํŒจํ„ด https://sup2is.github.io/2020/06/22/abstract-factory-pattern.html Sup2's bl..

    Android Context(์ปจํ…์ŠคํŠธ)

    ์ปจํ…์ŠคํŠธ(Context) Android ์‹œ์Šคํ…œ์—์„œ ์ œ๊ณตํ•˜๋Š” ์ถ”์ƒ ํด๋ž˜์Šค, ์ปจํ…์ŠคํŠธ๋ฅผ ํ†ตํ•ด ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์— ๊ด€ํ•œ ์‹œ์Šคํ…œ ์ •๋ณด์— ์ ‘๊ทผ ๊ฐ€๋Šฅํ•˜๋‹ค. (getPackageName(), getResources(), startActivity() ๋“ฑ์˜ ๋ฉ”์†Œ๋“œ ์‚ฌ์šฉ๊ฐ€๋Šฅ) ์ปจํ…์ŠคํŠธ์—๋Š” ๋‘ ๊ฐ€์ง€ ์ข…๋ฅ˜๊ฐ€ ์žˆ๋‹ค. 1. ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ปจํ…์ŠคํŠธ(Application Context) ์‹ฑ๊ธ€ํ„ด ์ธ์Šคํ„ด์Šค(์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์‚ด์•„์žˆ๋Š” ๋™์•ˆ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์Œ) ์•กํ‹ฐ๋น„ํ‹ฐ๋‚˜ ์„œ๋น„์Šค ๊ฐ™์€ ์ปดํฌ๋„ŒํŠธ์—์„œ applicationContext๋ฅผ ์ง์ ‘ ํ˜ธ์ถœํ•˜์—ฌ ์‚ฌ์šฉ ๊ฐ€๋Šฅ 2. ๋ฒ ์ด์Šค ์ปจํ…์ŠคํŠธ(Base Context) ์•กํ‹ฐ๋น„ํ‹ฐ, ์„œ๋น„์Šค, ์ปจํ…ํŠธ ํ”„๋กœ๋ฐ”์ด๋”, ๋ธŒ๋กœ๋“œ ์บ์ŠคํŠธ ๋ฆฌ์‹œ๋ฒ„์˜ ๊ธฐ๋ฐ˜ ํด๋ž˜์Šค ๊ฐ๊ฐ์˜ ์ปดํฌ๋„ŒํŠธ์˜ ์ƒ๋ช…์ฃผ๊ธฐ๋ฅผ ๋”ฐ๋ฅธ๋‹ค. (์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ƒ์„ฑ๋˜๋ฉด ์„œ๋กœ ๋‹ค๋ฅธ ์ปจํ…์ŠคํŠธ๊ฐ€..

    Android/Kotlin: OkHttp3๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ WebSocket ํ†ต์‹ ์„ ํ•˜๋Š” ๋ฒ•

    1. AndroidManifest.xml์— ์ž‘์„ฑ 2. build.gradle(Module)์— ์ž‘์„ฑ dependencies { implementation 'com.squareup.okhttp3:okhttp:3.12.12' ... } 3. ListenerClass ์ƒ์„ฑ import android.util.Log import okhttp3.Response import okhttp3.WebSocket import okhttp3.WebSocketListener import okio.ByteString class WebSocketListener : WebSocketListener() { override fun onOpen(webSocket: WebSocket, response: Response?) { webSock..

    Android Studio : SQLiteDatabase insert()๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™ํ•˜์ง€ ์•Š์„๋•Œ, SQLException ๋ฐœ์ƒ ์˜ค๋ฅ˜, insertOrThread ์‚ฌ์šฉ๋ฒ•

    ๋ฐ”๋กœ ๋ณธ๋ก ๋ถ€ํ„ฐ ๋“ค์–ด๊ฐ€์ž. ์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค ์ƒ๋‹จ์˜ View -> Tool Windows -> Device File Explorer ํด๋ฆญ data -> data ํด๋ฆญ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ ํŒจํ‚ค์ง€ ์ด๋ฆ„์„ ์ฐพ์€ ํ›„ databases ํด๋”์— ์žˆ๋Š” ๋‘ ํŒŒ์ผ์„ ์‚ญ์ œ ํ›„ ๋‹ค์‹œ ์‹คํ–‰ํ•˜๋ฉด ๋œ๋‹ค. ๋ฐœ์ƒํ•œ ์ด์œ  1. ์ฒ˜์Œ์— ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ํ…Œ์ด๋ธ”์„ ์ž˜๋ชป ์ƒ์„ฑํ•จ (,)๋ฅผ ๋นผ๋จน์Œ.. val create = "create table memo (" + "no integer primary key" + "datetime integer "+ "mistake text "+ "result text "+ "feedback text" + ")" 2. ๋‹ค์‹œ ํ…Œ์ด๋ธ”์„ ์ •์ƒ์ ์œผ๋กœ ์ˆ˜์ • val create = "create table memo (" + "no..