Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

lee989898
Copy link
Contributor

No description provided.

@lee989898 lee989898 self-assigned this Aug 12, 2022
Copy link
Member

@KkamSonLee KkamSonLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰완료!! 바쁘신데 아주 고생하셨습니다!!

}
}

@SuppressLint("HandlerLeak")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 어노테이션은 왜 사용하신건가요??

Copy link
Member

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로 변경해보시는 것도 추천합니다 :)

Comment on lines +6 to +8

</data>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 태그는 사용안하시는거면 지워도 될 것 같습니다~!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 지우겠습니다!

Comment on lines +80 to +94
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)
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여러번 눌렀을 때 처리도 해주시면 좋을 것 같습니다~!!

Comment on lines +44 to +46
binding.img.post {
binding.img.setImageBitmap(ConvertBitMap().StringToBitmap(it))
}
Copy link
Member

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" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 퍼미션은 어디에서 사용하는건가요??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이미지 url로 가져올때 사용하고 있습니다!!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glide로 이미지를 로드하신다면 INTERNET 권한만 있어도 충분하지 않나요?!

Copy link
Member

@youngjinc youngjinc left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var count = 0
private var count = 0

}
}

@SuppressLint("HandlerLeak")
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 let 블록은 없어도 될 것 같은데요?!

Comment on lines +44 to +46
binding.img.post {
binding.img.setImageBitmap(ConvertBitMap().StringToBitmap(it))
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서도 마찬가지지만 왜 post를 쓰신건가요?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants