Advertisement
rikisaraan

AsyncGettingBitmapFromUrl

Dec 27th, 2020
1,515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.44 KB | None | 0 0
  1.    class AsyncGettingBitmapFromUrl: AsyncTask<String, String, Bitmap>() {
  2.         override fun doInBackground(vararg params: String?): Bitmap {
  3.             val url = URL(params[0])
  4.             val connection = url.openConnection() as HttpURLConnection
  5.             connection.doInput = true
  6.             connection.connect()
  7.  
  8.             val input = connection.inputStream
  9.             return BitmapFactory.decodeStream(input)
  10.         }
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement