How to create an android image viewer - Part 9 Displaying bitmap in the custom view ondraw method

preview_player
Показать описание
This is part 9 of the android tutorial series about creating an android image viewer using the android local storage framework that was introduced in android lollipop.

For part 9 we will be using the custom image view's ondraw method to display the bitmap.
This is in preparation for setting the pinch zoom implementation.

Github details:
The code can be found on github from the following instructions below

image-viewer-ondraw-bitmap

or you can run this command

image-viewer-ondraw-bitmap

In this tutorial we will cover:

- Getting the bitmap from the uri using the MediaStore
- Getting the display dimensions using DisplayMetrics
- Working out the aspect ratio from the bitmap
- Creating a scaled version of the bitmap
- Using the custom image view's canvas to draw the bitmap

API's covered
- DisplayMetrics

For much more information checkout

The previous tutorials were aimed at beginners to android but over time have been getting more complex as the original camera_intent app has developed.
This tutorial series is more aimed towards the intermediate developers thought for those who have been following the previous tutorial series, feel free to watch this android performance series.

Android studio (1.5) is the editor of choice (IDE) for this tutorial series.

This tutorial series is the start of what I expect to be many so I encourage comments and feedback to improve the quality and viewing experience.
Рекомендации по теме
Комментарии
Автор

This video helped me so much in a project I was working on. It is a crime that it doesn't have more likes.

petermcgill
Автор

you explain things so nicely. Please dont stop posting videos.

chomanthapa
Автор

Follow your videos and are of excellent quality. It was a time that you did not posted . Congratulations for your work.
They will have in future videos on databases with android ?

ConectvideoBr
welcome to shbcf.ru