Pergunta

I'm trying to show very large images (>=50MB) in my tablet app. Can I load on the fly a better image resolution (with inSampleSize) until get the high res while i do zoom? Or... Is it possible to load in memory only the visible part of the image? What is the best way to do this?

Thanks in advance

Foi útil?

Solução

It's not possible to display a very high resolution image with the same resolution in android as the memory allocated to an application is small. So you need to sample down the image. But with this approach as you zoom the image the visual artifacts will start to appear. For removing these you can increase the inSample size on zoom and again decode the resource with increased inSample size. You can add a limit so that the bitmap do not become very big.

Outras dicas

You can sample this image using Bitmap class in android .You can use this reference which i mention below

Android Developer

StackOverFlow

Sample Code

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top