ProgressDialog Deprecated

Deprecated

ProgressDialog์€ ๋Œ€์ฒด๋กœ API ์ž‘์—…์„ ์ง„ํ–‰ํ•˜๋ฉด์„œ ํ™”๋ฉด์„ ๋„˜์–ด๊ฐˆ๋•Œ ๊ธฐ๋‹ค๋ฆฌ๋Š” ๋กœ๋”ฉ ์ฐฝ์œผ๋กœ ์‚ฌ์šฉํ•œ๋‹ค.

ProgressDialog was deprecated in api level 26.

ํ•˜์ง€๋งŒ, ๊ตฌ๊ธ€์—์„œ ๋” ์ด์ƒ ProgressDialog๋ฅผ ์“ฐ์ง€ ๋ง๋ผ๊ณ  ํ–ˆ๋‹ค.
์•ˆ๋“œ๋กœ์ด๋“œ_๊ณต์‹๋ฌธ์„œ
์‚ฌ์‹ค์€ ์˜ค๋ž˜ ์ „ ๋ถ€ํ„ฐ ์•Œ๊ณ  ์žˆ์—ˆ์ง€๋งŒ, ์‚ฌ์šฉ์€ ๊ฐ€๋Šฅํ•˜๋‹ค.. ์ •์ž‘ ๋…ธ๋ž€์ƒ‰ ๊ฒฝ๊ณ ์™€ ์ทจ์†Œ์„ ์ด ๋ณด๊ธฐ ์‹ซ์—ˆ์„ ๋ฟ์ด์ง€.. ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋งํ•˜๋Š” ๊น€์— ๋Œ€์•ˆ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ„๋‹จํ•œ ์ฝ”๋“œ๋ฅผ ์†Œ๊ฐœํ• ๋ ค๊ณ  ํ•œ๋‹ค.


Code

val dialog = Dialog(this)
dialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) // ๋ฐฐ๊ฒฝ์„ ํˆฌ๋ช…ํ•˜๊ฒŒ
dialog.setContentView(ProgressBar(this)) // ProgressBar ์œ„์ ฏ ์ƒ์„ฑ
dialog.setCanceledOnTouchOutside(false) // ์™ธ๋ถ€ ํ„ฐ์น˜ ๋ง‰์Œ
dialog.setOnCancelListener { this.finish() } // ๋’ค๋กœ๊ฐ€๊ธฐ์‹œ ํ˜„์žฌ ์•กํ‹ฐ๋น„ํ‹ฐ ์ข…๋ฃŒ
dialog.show()

Categories:

Updated:

Leave a comment