작성
·
205
0
복치님 안녕하세요
if(getData == "2") 이 부분이 에러가 뜨는데 문자열로 바꾸라는것 같은데 "2" 이게 문자열 아닌가용
도저히 뭐를 어떻게 바꿔야 하는지를 모르겠어요 ㅜㅜ
package com.example.twiceapplication
import android.os.Bundle
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
class ImageInsideActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_imageinside)
val getData = intent.getStringArrayExtra("data")
val memberImage = findViewById<ImageView>(R.id.memberImageArea)
// Toast.makeText(this, getData, Toast.LENGTH_LONG).show()
if(getData == "1"){
memberImage.setImageResource(R.drawable.member_1)
}
if(getData == "2") {
memberImage.setImageResource(R.drawable.member_2)
}
if(getData == "3") {
memberImage.setImageResource(R.drawable.member_3)
}
if(getData == "4") {
memberImage.setImageResource(R.drawable.member_4)
}
if(getData == "5") {
memberImage.setImageResource(R.drawable.member_5)
}
if(getData == "6") {
memberImage.setImageResource(R.drawable.member_6)
}
if(getData == "7") {
memberImage.setImageResource(R.drawable.member_7)
}
if(getData == "8") {
memberImage.setImageResource(R.drawable.member_8)
}
if(getData == "9") {
memberImage.setImageResource(R.drawable.member_9)
}
}
}