Basic implementation android glide library

in utopian-io •  7 years ago 

cover.jpg

Hello steemian, this time i want to discuss one of the popular android library for downloading and catching named glide,I like this library, it’s fast and efficient open source media management and image loading framework for android.
If you create android apps, of course there will always be the possibility of using images in app content, so in my opinion this will be useful for you

How to use it ?

Integrating Glide in your project is very easy. First add the glide dependency to your build.gradle.
dependencies {
// glide
compile 'com.github.bumptech.glide:glide:3.7.0'
}

borobudur.jpg

Previously I have prepared the image to be used, the image url to be used is
'codedojo.asia/images/tutorial_glide/borobudur.jpg'
by the way do you know the contents of the image that i use in this example? it is a picture of borobudur, a 9th-century Mahayana Buddhist temple in Magelang, Central Java, Indonesia, and the world's largest Buddhist temple.
Ok, back to tutorial, In this occasion i will guide you to use it in android studio project
First creating new project
a. Give the application name TutorialGlide (or whatever name you want)
b. Select minimum SDK 16 or more
the following is a guide to the example of a glide implementation

Step 1 . Create application name(in application name must begin with a capital letter)

tg1.PNG

Step 2 Choose minimum SDK
In determining the sdk used we must see from the number of users as well as the minimum sdk version of the version of libary glide that we use.

tg2.PNG

Step 3 Choose Empty Activity
Android studio already provides some main template that we can use, like drawer, map, admob etc, but for now we only use Empty activity.
tg3.PNG

Step 4 set name main activity and main layout then wait until the process finish.

tg4.PNG

Add gradle for glide into app/build.gradle, after we added it dont forget to klik sync now on the top right of the screen

useglide.PNG

Add internet permission in manifest, of course this permission is required because we take pictures from the server, if the image you want to use is taken from the drawable folder, this permission is not required

manifest.PNG

Adding view in layout to show image, do not forget to add id to imageView, because id is needed when we initialize ImageView in MainActivity so that glide can recognize which view will be given image

layoutimage.PNG

Write some code for initialize ImageView and loading image from url into imageView in Main Activity

mainactivitycode.PNG

Now we can run this application on mobile or in emulator, do not forget internet connection because picture we take from server,

result of screenshot in my handphone

Screenshot_2017-12-19-23-29-36.jpg

if you want to change the image to a size of 200px wide and 200px height and crop it in the center you can use this script :
glideresize.PNG

output after using resize script ini glide

Screenshot_2017-12-19-23-36-21.jpg

Conclusion

For the needs of the image process using glide is very easy, even google recommends the use of glide and use it in their internal project. besides using glide, for loading image we can also use other alternative that is picasso. if made a comparison between picasso and glide, each has advantages and disadvantages. For custom glides such as circular images, gallery creation and image content implementation using adapters we can discuss in the next post.



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Why are you using an outdated library version?
Get the 4.4.0 tutorial here: https://github.com/bumptech/glide

thanks for the info :)

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

thanks for your review

Hey @fahrulhidayat I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • This is your first accepted contribution here in Utopian. Welcome!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x