소개
게시글
질문&답변
2024.03.26
Retrofit + ViewModelScope + RecyclerView + Glide 강의중에서
아래처럼 수정하니 Glide 부분에 에러가 사라지는군요 왜 그럴까요 ??? build.gradle.kts implementation("com.github.bumptech.glide:glide:4.14.2") annotationProcessor("com.github.bumptech.glide:compiler:4.14.2") AndroidManifest.xml
- 0
- 2
- 73
질문&답변
2024.03.25
Retrofit 간단한 예제 변경 강의중에서
아차 제실수이군요 AndroidManifest.xml 부분을 입력하지 않았습니다 죄송합니다
- 0
- 2
- 75
질문&답변
2024.03.20
LiveData 와 MutableLiveData 차이강의중에서
해당코드를 viewModel = ViewModelProvider(this)[MainViewModel:: class. java ] 로 변경하니 오류가 사라지네요 캄사합니다
- 0
- 5
- 155
질문&답변
2024.03.17
Room db kotlin 관련질문
project build.gradle.kts plugins { id( "com.androi d.application") version "8.2.2" apply false id ("org.jetbrains.kotlin.andro id") version "1.9.22" apply false kotlin ("kapt") version "1.9.21" } Module 수준의 build.gradle.kts plugins { id( "com.androi d.application") id ("org.jetbrains.kotlin.andro id") id("org.jetbrains.kotlin.kapt") } android { namespace = "com.dongguninnovatiion.db_room2" compileSdk = 34 defaultConfig { applicationId = "com.dongguninnovatiion.db_room2" minSdk = 24 targetSdk = 34 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-a ndroid-optimize.tx t"), "proguard-rules.pro" ) } getByName("debug") { sourceSets { getByName("main") { java.srcDir(File("build/generated/ksp/debug/kotlin")) } } } } compileOptions { sourceCompatibility = JavaVersion. VERSION_1_8 targetCompatibility = JavaVersion. VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" } buildFeatures { dataBinding = true viewBinding = true } } dependencies { implementation ("androidx.core:core-ktx:1.12.0") implementation (" androidx.appcompat :appcompat:1.6.1") implementation ("com.google.android.material:material:1.11.0") implementation ("androidx.constraintlayout:constraintlayout:2.1.4") testImplementation ("junit:junit:4.13.2") androidTestImplementation ("androidx.test.ext:junit:1.1.5") androidTestImplementation ("androidx.test.espresso:espress o-core:3.5.1" ) val roomVersion = "2.6.1" implementation ("and roidx.room:ro om-runtime:$roomVersion") annotationProcessor ("androidx.room:room-compiler:$roomVers ion") // opt ional - RxJava2 support for Room implementation ("androidx.room:room-rxjava2:$roomV ersion") // optional - RxJava3 support for Room implementation ("androidx.room:room-rxjava3:$roomVersion") // optional - Guava suppor t for Room, i ncluding Optional and ListenableFuture implementation ("androidx.room:roo m-guava:$room Version") // optional - Test helpers testImplementation ("androidx.room:room-t esting:$roomV ersion") // optional - Paging 3 Integration implementation ("androidx.room:room-paging:2.4.0-rc01") } MainActivity.kt class MainActivity : AppCompatActivity() { private lateinit var binding: ActivityMainBinding private lateinit var db: TodoDatabase override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityMainBinding.inflate( layoutInflater ) setContentView(binding. root ) val db = Room.databaseBuilder( applicationContext , TodoDataba se::class. java ,"Todo" ).allowMainThreadQueries().build() binding.addBtn.setOnClickListener { addTodo() refreshTodo() } } private fun addTodo() { val t1 = binding.todoEdit. text . toString() Co routineScope (Dispatchers.IO). launch { db.todoDao().insert(Todo(t1)) } } private fun refreshTodo() { CoroutineScope (Dispatchers.Main). la unch { val da ta = CoroutineScope (Dispatchers.IO). async { db.todoDao().getAll().toString() } .await() if(data != null) { // binding.resultText.setText("${data.toString()}") } } } } 이렇게 수정하여도 앱이 죽는군요
- 0
- 2
- 85
질문&답변
2024.03.12
Room db kotlin 강의중에서
일부오류는 사라졌으나 아래부분에서 오류가 발생합니다 addButton.setOnClickListener( db.todoDao().insert(Todo(todoEdit. text .toString())) resultText.text = db.todoDao().getAll().toString() ) (사진)
- 0
- 3
- 104