Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

270
Vistas
how to resolve java.io.FileNotFoundException when trying to get inputstream from AWS url

my main goal is to get the orientation of a image which I get from AWS, part of the code is to first get the imputStream for which I need to pass the URI, I am doing Uri.parse(url) to get the uri and when I try to get URI I get

java.io.FileNotFoundException: No content provider

URL passed:

https://xxx-2.amazonaws.com/YRINWoUKBOW97VXvpnRelWioT2r2/6d95054e-8a6c-4a61-a4ff-18f63aa187b4/1/thumbnail.png?X-Amz-Algorithm=AWS4-HMAC-xx&X-Amz-Date=20220221T203050Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1800&X-Amz-Credential=AKIAJGEUAZB7E5XX6NPA%2F20220221%2Feu-west-2%2Fs3%xx&X-Amz-Signature=d3839d925efc6fffff417e25af1e6bad28ed10ef27d1c4460d20470

error

java.io.FileNotFoundException: No content provider: https://xxx2.amazonaws.com/YRINWoUKBOW97VXvpnRelWioT2r2/6d95054e-8a6c-4a61-a4ff-18f63aa187b4/1/thumbnail.png?X-Amz-Algorithm=AWS4-HMAC-xxx&X-Amz-Date=20220221T203050Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1800&X-Amz-Credential=AKIAJGEUAZB7E5XX6NPA%2F20220221%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Signature=d3839dffff925efc6417e25aff414d76b8ed10ef27d1c4460d20470

this is my code

private fun getExifOrientationFromURI(context: Context, url: String): Int {
        var orientation: Int = 1
        try {
    context.contentResolver.openInputStream(Uri.parse(url)).use { inputStream -> //ERROR IS AT THIS LINE 
                if(inputStream == null) return  orientation
                val exif = ExifInterface(inputStream)
                orientation =
                    exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
            }
        } catch (e: IOException) {
            e.printStackTrace()
        }
        return orientation
    }

what am I doing wrong?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

openInputStream() on ContentResolver does not support http or https URLs, only file, content, and android.resource Uri values. You need to use an HTTPS API for your URL, such as OkHttp.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda