Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get Image from URL using glide library

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 370
    Comment on it

    The below example code will helps you to get Image from URL by using glide library and to wait for image until it loaded.  For this in below example I have added glide library in  build.gradle file then I am using Glide with MainActivity class and get (position) into imageView.In below example when you have clicked on button then image will get displayed  from URL.

    Step(1)-I have added first glide library in  build.gradle file

          compile 'com.github.bumptech.glide:glide:3.7.0'


    Step(2)-MainActivity -
                           

    
    button.setOnClickListener(new View.OnClickListener() {
    
                @Override
                public void onClick(View v) {
                              //progressBar
                    final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress);
                    progressBar.setVisibility(View.VISIBLE);
    
                //Using Glide class
                    Glide.with(MainActivity.this)
                            .load("http://www.androidbegin.com/tutorial/flag/unitedstates.png")
                            .into(new GlideDrawableImageViewTarget(image) {
                                @Override
                                public void onResourceReady(GlideDrawable drawable, GlideAnimation anim) {
                                    super.onResourceReady(drawable, anim);
                                    progressBar.setVisibility(View.GONE);
    
                                }
                            });
    

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: