티스토리 뷰

Android/Etc

[ Etc #20 ] AOS Image Url Bitmap 가져오기

녹색꼬맹이 2024. 5. 30. 14:44
반응형
SMALL

 

반응형
SMALL

 

 

fun getBitmapFromURL(src: String): Bitmap? {
    return try {
        val url = URL(src)
        val connection =
            url.openConnection() as HttpURLConnection
        connection.setDoInput(true)
        connection.connect()
        val input = connection.inputStream
        BitmapFactory.decodeStream(input)
    } catch (e: IOException) {
        e.printStackTrace()
        null
    }
}
반응형
LIST
댓글