게시글
질문&답변
2024.04.25
Navigation Data Transfer Safe Args 강의중에서
Too many arguments for public final fun actionBlankFragment1ToBlankFragment2(): NavDirections defined in com.dongguninnovatiion.navidatatransfer.BlankFragment1Directions.Companion 이런메세지가 뜨는군요 ..
- 0
- 2
- 92
질문&답변
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
- 91
질문&답변
2024.03.25
Retrofit 간단한 예제 변경 강의중에서
아차 제실수이군요 AndroidManifest.xml 부분을 입력하지 않았습니다 죄송합니다
- 0
- 2
- 90
질문&답변
2024.03.20
LiveData 와 MutableLiveData 차이강의중에서
해당코드를 viewModel = ViewModelProvider(this)[MainViewModel:: class. java ] 로 변경하니 오류가 사라지네요 캄사합니다
- 0
- 5
- 171
질문&답변
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
- 96
질문&답변
2024.03.12
Room db kotlin 강의중에서
일부오류는 사라졌으나 아래부분에서 오류가 발생합니다 addButton.setOnClickListener( db.todoDao().insert(Todo(todoEdit. text .toString())) resultText.text = db.todoDao().getAll().toString() ) (사진)
- 0
- 3
- 137
질문&답변
2024.03.11
LiveData 와 MutableLiveData 차이강의중에서
github 주소 올려두었습니다
- 0
- 5
- 171
질문&답변
2024.03.11
Room db kotlin 강의중에서
http://schemas.android.com/apk/res/android " xmlns:app= "http://schemas.android.com/apk/res-aut o" xmlns:tools ="http://schemas.android.com/too ls" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> android:id="@+id/todo_edit" android:hint="활동메모" android:layout_margin="20dp" android:layout_width="match_parent" android:layout_height="60dp" android:background="@android:color/transparent" tools:ignore="MissingConstraints" /> android:id="@+id/result_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> android:id="@+id/add_button" android:text="추가" android:textColor="@color/white" android:background="@color/black" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:layout_marginStart="160dp" android:layout_marginTop="256dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" />
- 0
- 3
- 137
질문&답변
2024.03.10
LiveData 와 MutableLiveData 차이강의중에서
github 주소입니당 https://github.com/dongguntechnology/ViewModelMutableLiveData
- 0
- 5
- 171
질문&답변
2024.03.07
LiveData 와 MutableLiveData 차이강의중에서
class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout. activity_main ) viewModel = ViewModelProvider(this).get(MainViewMo del::class .java) findViewById utto n>(R.id. btnArea ).setOnClickListener { viewModel .plusLiveDataValue() } viewModel .testLiveData.observe(this, Observer { findViewByI d xtView>(R.id. textArea ). text = it .toString() } ) } }
- 0
- 5
- 171