I'm making a little geography app where I wish to display a country's flag (svg). The flag image resources are online link (in svg format).
Eg: Albania Flag - > https://flagcdn.com/al.svg
This is my code:
flag = "https://flagcdn.com/al.svg"
val thread = Thread {
try {
val flagURL = URL(flag)
println("variable URL : ${flagURL }")
val flagValue = BitmapFactory.decodeStream(flagURL.openConnection().getInputStream())
println("variable in flagValue : ${flagValue}")
binding.flagValue.setImageBitmap(flagValue)
} catch (e: Exception) {
e.printStackTrace()
println("failed")
}
}
thread.start()
When the code runs, an error is detected in the try / catch section:
D/skia: --- Failed to create image decoder with message 'unimplemented'
I/System.out: variable in flagValue : null
I got my code from this previously asked question, but it doesn't work for me. Any ideas? Thanks