-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Week8 thread handler looper #4
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰완료!! 바쁘신데 아주 고생하셨습니다!!
} | ||
} | ||
|
||
@SuppressLint("HandlerLeak") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 어노테이션은 왜 사용하신건가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 궁금해서 찾아봤는데 핸들러 클래스가 외부 클래스에 대한 참조를 유지하지 않도록 한다고 하네요! inner class를 사용하셨기 때문에 ide에서 해당 어노테이션 추가를 제안했나봅니다~ 추후 inner class -> nested class로 변경해보시는 것도 추천합니다 :)
|
||
</data> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 태그는 사용안하시는거면 지워도 될 것 같습니다~!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 지우겠습니다!
inner class BackgroundThread3 : Thread() { | ||
override fun run() { | ||
//implement Count | ||
while (isAlive) { | ||
val bundle = Bundle() | ||
val msg = myHandler.obtainMessage() | ||
count++ | ||
bundle.putInt("count", count) | ||
with(msg) { | ||
data = bundle | ||
SystemClock.sleep(1000) | ||
myHandler.sendMessage(this) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여러번 눌렀을 때 처리도 해주시면 좋을 것 같습니다~!!
binding.img.post { | ||
binding.img.setImageBitmap(ConvertBitMap().StringToBitmap(it)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋슴다~!!
package="com.lee989898.myapplication"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 퍼미션은 어디에서 사용하는건가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이미지 url로 가져올때 사용하고 있습니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glide로 이미지를 로드하신다면 INTERNET 권한만 있어도 충분하지 않나요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰 완! 고생 많으셨습니다 :)
|
||
private lateinit var binding: ActivityMainBinding | ||
private lateinit var myHandler: Handler | ||
var count = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var count = 0 | |
private var count = 0 |
} | ||
} | ||
|
||
@SuppressLint("HandlerLeak") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 궁금해서 찾아봤는데 핸들러 클래스가 외부 클래스에 대한 참조를 유지하지 않도록 한다고 하네요! inner class를 사용하셨기 때문에 ide에서 해당 어노테이션 추가를 제안했나봅니다~ 추후 inner class -> nested class로 변경해보시는 것도 추천합니다 :)
// 다른 Thread에서 전달받은 Message 처리 | ||
val getBundle = msg.data | ||
val img = getBundle.getString("image") | ||
img.let { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 let 블록은 없어도 될 것 같은데요?!
binding.img.post { | ||
binding.img.setImageBitmap(ConvertBitMap().StringToBitmap(it)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서도 마찬가지지만 왜 post를 쓰신건가요?!
No description provided.