Loading an image from internet is pretty easier using Volley library. But here is a much better solution than volley i.e Glide image library. When compared to volley, Glide wins in lot of scenarios in terms of performance and usability. Below are the advantages of Glide over volley

> Supports fetching, decoding, and displaying video stills, images, and animated GIFs
> Placeholder can be added before the loading the media
> Loads thumbnail (blurred) first and then loads the high resolution image like in WhatsApp or Facebook.
> Crossfading effects between the media
> Supports image arbitrary transformations like loading image in circular shape or any other shape.
> Better Memory and disk caching mechanisms
> Works well with both Volley and OkHttp libraries

This article explains how to build a simple image gallery app where all the images will be loaded from internet. First all the thumbnail images displayed in a grid manner and upon selecting the single image, a fullscreen image slider will be launched.

android-working-with-glide-image-library

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'
}

Second load the image into ImageView using below code snippet.

String imgUrl = "https://api.androidhive.info/images/glide/medium/deadpool.jpg";

ImageView imageView = (ImageView) view.findViewById(R.id.thumbnail);

Glide.with(mContext).load(imgUrl)
                .thumbnail(0.5f)
                .crossFade()
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(imageView);

Sample JSON

To build the gallery app, I have created a sample JSON which contains the image urls required. Each image is highly compressed and resized in three different resolutions i.e Higher, medium and smaller. For the grid display, we load the medium resolution image and for the fullscreen image slider, we load the higher resolution image.

JSON link: https://api.androidhive.info/json/glide.json

[{
	"name": "Deadpool",
	"url": {
		"small": "https://api.androidhive.info/images/glide/small/deadpool.jpg",
		"medium": "https://api.androidhive.info/images/glide/medium/deadpool.jpg",
		"large": "https://api.androidhive.info/images/glide/large/deadpool.jpg"
	},
	"timestamp": "February 12, 2016"
},
{
	"name": "Batman vs Superman",
	"url": {
		"small": "https://api.androidhive.info/images/glide/small/bvs.png",
		"medium": "https://api.androidhive.info/images/glide/medium/bvs.png",
		"large": "https://api.androidhive.info/images/glide/large/bvs.png"
	},
	"timestamp": "March 25, 2016"
}]

Now let’s start building the image gallery app.

Building Image Gallery App

1. Create a new project in Android Studio from File ⇒ New Project. When it prompts you to select the default activity, select Blank Activity and proceed.

2. Open build.gradle and add Glide, Volley and RecyclerView dependencies. Volley is used to download the gallery json by making HTTP call. RecyclerView is used to show the gallery images in a Grid fashion.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.2.1'
    compile 'com.android.support:support-v4:23.2.1'

    // RecyclerView
    compile 'com.android.support:recyclerview-v7:23.1.1'

    // volley
    compile 'com.android.volley:volley:1.0.0'

    // Glide
    compile 'com.github.bumptech.glide:glide:3.7.0'
}

3. Create three packages named activity, adapter, app, model and helper and place your MainActivity.java under activity package. These packages helps in keeping your project organized.

4. Create a class named AppController.java under app package. This is a singleton class in which we initialize the volley’s core objects.

package info.androidhive.glide.app;

import android.app.Application;
import android.text.TextUtils;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

public class AppController extends Application {

    public static final String TAG = AppController.class
            .getSimpleName();

    private RequestQueue mRequestQueue;

    private static AppController mInstance;

    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
    }

    public static synchronized AppController getInstance() {
        return mInstance;
    }

    public RequestQueue getRequestQueue() {
        if (mRequestQueue == null) {
            mRequestQueue = Volley.newRequestQueue(getApplicationContext());
        }

        return mRequestQueue;
    }

    public <T> void addToRequestQueue(Request<T> req, String tag) {
        // set the default tag if tag is empty
        req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
        getRequestQueue().add(req);
    }

    public <T> void addToRequestQueue(Request<T> req) {
        req.setTag(TAG);
        getRequestQueue().add(req);
    }

    public void cancelPendingRequests(Object tag) {
        if (mRequestQueue != null) {
            mRequestQueue.cancelAll(tag);
        }
    }
}

5. Open AndroidManifest.xml and add the AppController to <application> tag. Also add the INTERNET permission as we need to make HTTP calls.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="info.androidhive.glide">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name=".app.AppController"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".activity.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Now our project is ready with all the dependencies added. Let’s start adding the grid gallery first.

Adding the Grid Gallery View

6. Open the layout files of your main activity and add the recyclerView. For my main activity I have two layout files activity_main.xml and content_main.xml

The activity_main.xml contains the general AppBar and Toolbar.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".activity.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_main" />

</android.support.design.widget.CoordinatorLayout>

The content_main.xml contains the recyclerView to load the images in grid.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="info.androidhive.glide.activity.MainActivity"
    tools:showIn="@layout/activity_main">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical" />

</RelativeLayout>

7. Under helper package, create a class named SquareLayout.java. This class helps the images to display in square ratio in grid view.

package info.androidhive.glide.helper;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

/**
 * Created by Lincoln on 05/04/16.
 */
class SquareLayout extends RelativeLayout {

    public SquareLayout(Context context) {
        super(context);
    }

    public SquareLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public SquareLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public SquareLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        // Set a square layout.
        super.onMeasure(widthMeasureSpec, widthMeasureSpec);
    }
}

8. Under res ⇒ layout, create a layout named gallery_thumbnail.xml. This layout contains an ImageView to display the thumbnail image in gallery view.

9. Under adapter package, create a class named GalleryAdapter.java This is a adapter class which inflates the gallery_thumbnail.xml and renders the images in recyclerView.

package info.androidhive.glide.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;

import java.util.List;

import info.androidhive.glide.R;
import info.androidhive.glide.model.Image;

/**
 * Created by Lincoln on 31/03/16.
 */

public class GalleryAdapter extends RecyclerView.Adapter<GalleryAdapter.MyViewHolder> {

    private List<Image> images;
    private Context mContext;

    public class MyViewHolder extends RecyclerView.ViewHolder {
        public ImageView thumbnail;

        public MyViewHolder(View view) {
            super(view);
            thumbnail = (ImageView) view.findViewById(R.id.thumbnail);
        }
    }


    public GalleryAdapter(Context context, List<Image> images) {
        mContext = context;
        this.images = images;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.gallery_thumbnail, parent, false);

        return new MyViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        Image image = images.get(position);

        Glide.with(mContext).load(image.getMedium())
                .thumbnail(0.5f)
                .crossFade()
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(holder.thumbnail);
    }

    @Override
    public int getItemCount() {
        return images.size();
    }

    public interface ClickListener {
        void onClick(View view, int position);

        void onLongClick(View view, int position);
    }

    public static class RecyclerTouchListener implements RecyclerView.OnItemTouchListener {

        private GestureDetector gestureDetector;
        private GalleryAdapter.ClickListener clickListener;

        public RecyclerTouchListener(Context context, final RecyclerView recyclerView, final GalleryAdapter.ClickListener clickListener) {
            this.clickListener = clickListener;
            gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
                @Override
                public boolean onSingleTapUp(MotionEvent e) {
                    return true;
                }

                @Override
                public void onLongPress(MotionEvent e) {
                    View child = recyclerView.findChildViewUnder(e.getX(), e.getY());
                    if (child != null && clickListener != null) {
                        clickListener.onLongClick(child, recyclerView.getChildPosition(child));
                    }
                }
            });
        }

        @Override
        public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {

            View child = rv.findChildViewUnder(e.getX(), e.getY());
            if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) {
                clickListener.onClick(child, rv.getChildPosition(child));
            }
            return false;
        }

        @Override
        public void onTouchEvent(RecyclerView rv, MotionEvent e) {
        }

        @Override
        public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {

        }
    }
}

10. Finally open MainActivity.java and do the below changes

> Download the json by making volley http request. fetchImages() method is used for this purpose

> Parse the json and add the models to array list.

> Pass the array list to recyclerView’s adapter class.

package info.androidhive.glide.activity;

import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

import info.androidhive.glide.R;
import info.androidhive.glide.adapter.GalleryAdapter;
import info.androidhive.glide.app.AppController;
import info.androidhive.glide.model.Image;

public class MainActivity extends AppCompatActivity {

    private String TAG = MainActivity.class.getSimpleName();
    private static final String endpoint = "https://api.androidhive.info/json/glide.json";
    private ArrayList<Image> images;
    private ProgressDialog pDialog;
    private GalleryAdapter mAdapter;
    private RecyclerView recyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        recyclerView = (RecyclerView) findViewById(R.id.recycler_view);

        pDialog = new ProgressDialog(this);
        images = new ArrayList<>();
        mAdapter = new GalleryAdapter(getApplicationContext(), images);

        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(getApplicationContext(), 2);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setAdapter(mAdapter);

        /* recyclerView.addOnItemTouchListener(new GalleryAdapter.RecyclerTouchListener(getApplicationContext(), recyclerView, new GalleryAdapter.ClickListener() {
            @Override
            public void onClick(View view, int position) {
                Bundle bundle = new Bundle();
                bundle.putSerializable("images", images);
                bundle.putInt("position", position);

                FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                SlideshowDialogFragment newFragment = SlideshowDialogFragment.newInstance();
                newFragment.setArguments(bundle);
                newFragment.show(ft, "slideshow");
            }

            @Override
            public void onLongClick(View view, int position) {

            }
        }));*/

        fetchImages();
    }

    private void fetchImages() {

        pDialog.setMessage("Downloading json...");
        pDialog.show();

        JsonArrayRequest req = new JsonArrayRequest(endpoint,
                new Response.Listener<JSONArray>() {
                    @Override
                    public void onResponse(JSONArray response) {
                        Log.d(TAG, response.toString());
                        pDialog.hide();

                        images.clear();
                        for (int i = 0; i < response.length(); i++) {
                            try {
                                JSONObject object = response.getJSONObject(i);
                                Image image = new Image();
                                image.setName(object.getString("name"));

                                JSONObject url = object.getJSONObject("url");
                                image.setSmall(url.getString("small"));
                                image.setMedium(url.getString("medium"));
                                image.setLarge(url.getString("large"));
                                image.setTimestamp(object.getString("timestamp"));

                                images.add(image);

                            } catch (JSONException e) {
                                Log.e(TAG, "Json parsing error: " + e.getMessage());
                            }
                        }

                        mAdapter.notifyDataSetChanged();
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e(TAG, "Error: " + error.getMessage());
                pDialog.hide();
            }
        });

        // Adding request to request queue
        AppController.getInstance().addToRequestQueue(req);
    }
}

If you run the app, you can see the images displayed in grid manner. Be sure that your device is connected to internet.

android-image-gallery-using-glide-library

Fullscreen Image Slideshow

Now we’ll see how to build a fullscreen image slider with swiping functionality. We use a DialogFragment and ViewPager for this purpose.

11. Create a layout named image_fullscreen_preview.xml under res ⇒ layout. This layout is used to display the image in fullscreen view.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/black">

    <ImageView
        android:id="@+id/image_preview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_centerInParent="true"
        android:scaleType="fitCenter" />

</RelativeLayout>

12. Under activity package, create a class named SlideshowDialogFragment.java. This is a fragment class which extends DialogFragment.

package info.androidhive.glide.activity;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;

import java.util.ArrayList;

import info.androidhive.glide.R;
import info.androidhive.glide.model.Image;


public class SlideshowDialogFragment extends DialogFragment {
    private String TAG = SlideshowDialogFragment.class.getSimpleName();
    private ArrayList<Image> images;
    private ViewPager viewPager;
    private MyViewPagerAdapter myViewPagerAdapter;
    private TextView lblCount, lblTitle, lblDate;
    private int selectedPosition = 0;

    static SlideshowDialogFragment newInstance() {
        SlideshowDialogFragment f = new SlideshowDialogFragment();
        return f;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_image_slider, container, false);
        viewPager = (ViewPager) v.findViewById(R.id.viewpager);
        lblCount = (TextView) v.findViewById(R.id.lbl_count);
        lblTitle = (TextView) v.findViewById(R.id.title);
        lblDate = (TextView) v.findViewById(R.id.date);

        images = (ArrayList<Image>) getArguments().getSerializable("images");
        selectedPosition = getArguments().getInt("position");

        Log.e(TAG, "position: " + selectedPosition);
        Log.e(TAG, "images size: " + images.size());

        myViewPagerAdapter = new MyViewPagerAdapter();
        viewPager.setAdapter(myViewPagerAdapter);
        viewPager.addOnPageChangeListener(viewPagerPageChangeListener);

        setCurrentItem(selectedPosition);

        return v;
    }

    private void setCurrentItem(int position) {
        viewPager.setCurrentItem(position, false);
        displayMetaInfo(selectedPosition);
    }

    //	page change listener
    ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            displayMetaInfo(position);
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {

        }

        @Override
        public void onPageScrollStateChanged(int arg0) {

        }
    };

    private void displayMetaInfo(int position) {
        lblCount.setText((position + 1) + " of " + images.size());

        Image image = images.get(position);
        lblTitle.setText(image.getName());
        lblDate.setText(image.getTimestamp());
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
    }

    //	adapter
    public class MyViewPagerAdapter extends PagerAdapter {

        private LayoutInflater layoutInflater;

        public MyViewPagerAdapter() {
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {

            layoutInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View view = layoutInflater.inflate(R.layout.image_fullscreen_preview, container, false);

            ImageView imageViewPreview = (ImageView) view.findViewById(R.id.image_preview);

            Image image = images.get(position);

            Glide.with(getActivity()).load(image.getLarge())
                    .thumbnail(0.5f)
                    .crossFade()
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .into(imageViewPreview);

            container.addView(view);

            return view;
        }

        @Override
        public int getCount() {
            return images.size();
        }

        @Override
        public boolean isViewFromObject(View view, Object obj) {
            return view == ((View) obj);
        }


        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }
    }
}

13. Open MainActivity.java and add the click event to recyclerView in onCreate() method. (This code is already provided in above step, just uncomment it)

        recyclerView.addOnItemTouchListener(new GalleryAdapter.RecyclerTouchListener(getApplicationContext(), recyclerView, new GalleryAdapter.ClickListener() {
            @Override
            public void onClick(View view, int position) {
                Bundle bundle = new Bundle();
                bundle.putSerializable("images", images);
                bundle.putInt("position", position);

                FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                SlideshowDialogFragment newFragment = SlideshowDialogFragment.newInstance();
                newFragment.setArguments(bundle);
                newFragment.show(ft, "slideshow");
            }

            @Override
            public void onLongClick(View view, int position) {

            }
        }));

Run the app once more and try tapping on thumbnail image. You should see the fullscreen image slider with swiping functionality enabled.

andorid-fullscreen-image-slider-using-glide-library
Subscribe
Notify of
guest
480 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Akkis
4 years ago

So much interesting tutorial. Thank you once again 🙂

Ravi Tamada
4 years ago
Reply to  Akkis

I am glad you find it interesting.

Samir Kelbeliyev
Samir Kelbeliyev
4 years ago

very helpfull thanks… i try it fragment and getSupportFragmentManager make error can i use it?

Ravi Tamada
4 years ago

Instead of getSupportFragmentManager(), try calling getFragmentManager ()

Leng AK
Leng AK
4 years ago

Good tutorial. Mr. Ravi Tamada. But i want to know, does glide free for commercial use?

Ravi Tamada
4 years ago
Reply to  Leng AK

It’s free. Open source.

Maheswaran S
Maheswaran S
4 years ago

good one and good change of website!! 🙂 🙂 great work

Ravi Tamada
4 years ago
Reply to  Maheswaran S

Thanks 🙂

sridhar
sridhar
4 years ago

please check the content_main.xml file .

Ravi Tamada
4 years ago
Reply to  sridhar

Thanks sridhar. I updated it.

vinod
vinod
4 years ago

nice tutorial sir

@rpit Patel
@rpit Patel
4 years ago

It’s been a long time happy to see you again and nice tutorial. one question in your opinion Which was the best library for parsing json?

Ravi Tamada
4 years ago
Reply to  @rpit Patel

Use jackson

@rpit Patel
@rpit Patel
4 years ago
Reply to  Ravi Tamada

Thanks for reply

Jaydeep Kacha
Jaydeep Kacha
4 years ago

Peoples are eagerly waiting for Retrofit tutorial !!!

Jaydeep Kacha
Jaydeep Kacha
4 years ago

Peoples are eagerly waiting for Retrofit tutorial !

Ankit Mehrotra
Ankit Mehrotra
4 years ago

I’m getting a Volley Error, error.getMessage()-> null, error.toString()-> timeOut error.

Afratul Kaoser
Afratul Kaoser
4 years ago

very helpful for my project. but how can i show this images in offline? please help

ABDELKARIM TINGUER
ABDELKARIM TINGUER
4 years ago

very useful tutorial, thank you. What you think about Retrofit and volley which one is the best ?

Chintan Rathod
4 years ago

Nice article…

Mohamed emad
Mohamed emad
4 years ago

How to import it to android studio as i can’t import it correctly

Harshit Pathak
Harshit Pathak
4 years ago
Reply to  Mohamed emad

Download a jar file of Glide. Move it to the libs folder of your project app. (You can do this from the explorer). Then in Android Studio, Go to the Project panel in the left, then to that libs folder. Right click and then “Add as library”.

Afratul Kaoser
Afratul Kaoser
4 years ago

How can i set selected images as wallpaper? please help

Judie
Judie
4 years ago
Reply to  Afratul Kaoser

here: 13. Open MainActivity.java and add the click event to recyclerView in onCreate() method. (This code is already provided in above step, just uncomment it)……

Judie
Judie
4 years ago

Here’s a mistake Error:(2) No resource identifier found for attribute ‘layout_behavior’ in package ‘com.my.asus.myglide’ in the content_main.xml app:layout_behavior=”@string/appbar_scrolling_view_behavior” who can tell me how to do

Judie
Judie
4 years ago
Reply to  Judie

I find it : compile ‘com.android.support:design:23.2.1’ compile ‘com.android.support:support-v4:23.2.1’

Myth
Myth
4 years ago

tks for sharing!

Subhi Ayman
Subhi Ayman
4 years ago

A very great tutorial. Thank you, But when I click on a specific photo it does not getting larger but the application is staying at the Grid view. If you can help me with that?

Bruno Casado
Bruno Casado
4 years ago
Reply to  Subhi Ayman

Same problem here. It’s always a longclick, so it doesn’t go full screen. Could you be able to solve?

akin
akin
4 years ago
Reply to  Subhi Ayman

Please help , I have same problem

Chaitanya Tanna
Chaitanya Tanna
4 years ago

Image.java is missing under model package

Asiedu Amoako
Asiedu Amoako
4 years ago

A very good tutorial, thank you so much. I want to put the image name on the pictures in the gridview, how do i go about this. Thanks in advance.

Ravi Tamada
4 years ago
Reply to  Asiedu Amoako

You need to keep a TextView in gallery_thumbnail.xml and set the value in adapter class

Afratul Kaoser
Afratul Kaoser
4 years ago

Please help me.. how can i save image or set as wallpaper from this?

Keval Padia
4 years ago

superb

Sr
Sr
4 years ago

Why do I get layout like this?

http://i.imgur.com/JkWTKbi.png

Pradeep Pathak
Pradeep Pathak
4 years ago
Reply to  Sr

you did this. super.onMeasure(widthMeasureSpec, heightMeasureSpec);
instead of super.onMeasure(widthMeasureSpec, widthMeasureSpec); in SquareLayout Class

Kareem Hassan
Kareem Hassan
4 years ago

welcome back Ravi and Congratulations for new style

Sahad
Sahad
4 years ago

3. Create three packages named activity, adapter, app, model and helper and place your MainActivity.java under activity package. These packages helps in keeping your project organized.
How to make this step, i’m beginner

Ravi Tamada
4 years ago
Reply to  Sahad

Right click on your main package -> New -> Package

Ismail G
Ismail G
4 years ago
Reply to  Ravi Tamada

Hi sir hiw are you if u need code source contact me gismail095@gmail.com

Ismail G
Ismail G
4 years ago
Reply to  Sahad

Hi sir hiw are you if u need code source contact me gismail095@gmail.com
!

Murat
Murat
4 years ago

I get an error. What is the reason?

Error1 : Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.glide.app.glide.AppController.addToRequestQueue(com.android.volley.Request)’ on a null object reference

Error2: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.glide.app.glide/com.glide.app.glide.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.glide.app.glide.AppController.addToRequestQueue(com.android.volley.Request)’ on a null object reference

Ravi Tamada
4 years ago
Reply to  Murat

It seems you forgot to AppController to manifest file. Check 5th point

Ismail G
Ismail G
4 years ago
Reply to  Murat

Hi sir hiw are you if u need code source contact me gismail095@gmail.com ÷

Vajeng Patidar
Vajeng Patidar
4 years ago

its nice one

tohin
tohin
4 years ago

This is also a nice tutorial bro, would u give this ans plz? i completed the android basic level work, now i want to learn android advanced level how can i learn android advanced level? and Android Udacity android Courses are helpful or not for android developer ? please tell me, if u give me this ans it will help me plz, thank u

adam
adam
4 years ago

How you record this screen videos ?

Ismail G
Ismail G
4 years ago
Reply to  adam

Hi
Hi sir hiw are you if u need code source contacte me gismail095@gmail.com

Harshit Pathak
Harshit Pathak
4 years ago

The class under the model package is missing in this tutorial.

ohood
ohood
4 years ago

i have my pictures and i want to create my json file for it and upload it to server could u please explain how and which server and if i have website “word press” can i use it for this example

BlizzedRu
4 years ago

Hi, thank you very much! But what about zoom?

Ravi Tamada
4 years ago
Reply to  BlizzedRu
BlizzedRu
4 years ago
Reply to  Ravi Tamada

Thank you so much!

Ismail G
Ismail G
4 years ago
Reply to  BlizzedRu

Hi sir how are you if u need cod source contact me gismail095@gmail.com

ashwani Janu
ashwani Janu
4 years ago

Hi ravi, Thank you so much for another great tutorial… i wanna point out that Image class inside model package and fragment_image_slider.xml layout files are missing…

Ravi Tamada
4 years ago
Reply to  ashwani Janu

Hi Ashwani

I’ll check once again. Thank You

Ismail G
Ismail G
4 years ago
Reply to  Ravi Tamada

Hi sir how are you if u need code sourc contact me gismail095@gmail.com

Nagaraj N
Nagaraj N
4 years ago
Reply to  Ravi Tamada

Hi Ravi,

fragment_image_slider.xml layout file is missing, Please help to get it.

Ismail G
Ismail G
4 years ago
Reply to  ashwani Janu

Hi sir how are you if u need code source contact me gismail095@gmail.com

biplab barik
biplab barik
4 years ago

Hello. I use byethost to host my images. but when i am replacing “http://api.androidhive.info/json/glide.json” with “http://admingtrack.byethost18.com/glide/glide.json” it is not working .
The error is : “E/MainActivity: Error: org.json.JSONException: Value <script of type java.lang.String cannot be converted to JSONArray"

shivam pandey
shivam pandey
4 years ago

Thanks ravi, for another great tutorial. I wanted to know how can I make a feature like when the user refresh the app then it should make the call to server for new content unless it should show images from the cache at least thumbnails. Thanks again

Ismail G
Ismail G
4 years ago
Reply to  shivam pandey

Hi sir hiw are you if u need code source contact me gismail095@gmail.com

saranya
saranya
4 years ago

Error in MainActivity class (JsonConnectivity) how to clear this Json Error.

saranya
saranya
4 years ago
Reply to  saranya

some classes are missing above the app.Then i faced most of the problem in this difficult WindowActionbar then java.lang.NullPointerException is raised.

ARASHI Funsho
ARASHI Funsho
4 years ago

Please kindly add the style.xml and colour.xml files to the tutorial, or upload them separately. Thanks

Fábio Alves
Fábio Alves
4 years ago
Reply to  ARASHI Funsho

Agreed. Not that is was something difficult to do, but I had the download the source code in order to get it too. Before I did that, I thought I was doing something wrong or missing something.

ARASHI Funsho
ARASHI Funsho
4 years ago
Reply to  Fábio Alves

kindly email it to me Fabio….. farashi181@stu.ui.edu.ng Thanks in Advance

Sage Pawan
Sage Pawan
4 years ago

Great tutorial bro. I am having one issue though. Once a movie thumbnail is selected, the view pager adapter in SlideshowDialogFragment is unable to load the large image on fullscreen. I am using the same code. I even tried it with Picasso library but still same issue.

Ravi Tamada
4 years ago
Reply to  Sage Pawan

Is the image url you are loading is correct. Is it opening in browser?

Sage Pawan
Sage Pawan
4 years ago
Reply to  Ravi Tamada

Yes bro. I logged the image.getLarge(), it gives the url for large image which does open in the browser. And yet the glide is somehow not loading the image into full screen imageview. Just to ensure it is not device issue, I checked it in multiple emulator devices too. Still same.

Edit – I had hardcoded everything following your guide. So I might have missed something. I will double check through the code and debug again.

Ravi Tamada
4 years ago
Reply to  Sage Pawan

Okay. Pls debug and let me know. Just to a quick check, give the url directly in Glide method and check whether it is loading or not.

akin
akin
4 years ago
Reply to  Ravi Tamada

Please I am having same issue

Mouadh Saidani
Mouadh Saidani
4 years ago

Great tuto Ravi, can you please add Download wallpaper button to download each picture ?

Nikhil Singh
Nikhil Singh
4 years ago

Great tutorial Ravi bro. I want to make bitmap of the downloaded wallpapers so that i can perform some functions with it. Please tell me how to make bitmap from Glide images. Thanx

Mouadh Saidani
Mouadh Saidani
4 years ago

Great tuto Ravi, can you please add Download wallpaper button to download each picture ?

Ravi Tamada
4 years ago
Reply to  Mouadh Saidani
Mouadh Saidani
Mouadh Saidani
4 years ago
Reply to  Ravi Tamada

it’s not same with glide , I tried but I’m not successful

Bruno Casado
Bruno Casado
4 years ago

Hi, Ravi! I have a doubt. You didn’t put the Image Model on this example, did you? Would it be possible to put it? Thank you for your nice work!

sam jacky
sam jacky
4 years ago

Model class is missing is there any one who created the model class if soo plz mail me at samjacky80@gmail.com thank you in advance and nice tutorial sir

Sandeep Pradhan
Sandeep Pradhan
4 years ago
Reply to  sam jacky

download the code and extract and to go to respected folder to find the model.class

sam jacky
sam jacky
4 years ago

dear sandeep pradhan there is an error while downloading the file due to which i am unable to download source code will you please mail me the source code at samjacky80@gmail.com thanks in advance

Sandeep Pradhan
Sandeep Pradhan
4 years ago
Reply to  sam jacky

mailed bro check it

Sandeep Singh
Sandeep Singh
4 years ago

dear sandeep pradhan i have same problem::::Model class is missing is there any one who created the model class if soo plz mail me at sandeepsinghmbbs@gmail.com ..

tamer
tamer
4 years ago

Hello ravi can i integrate a video with this library ? kindly advice .

Ravi Tamada
4 years ago
Reply to  tamer
tamer
tamer
4 years ago
Reply to  Ravi Tamada

Hello

Thank you very much but unfortunately the library load videos from local phone only , but I need to load url from Internet ?

Regards

Eswar
Eswar
4 years ago

Can it be used to show images from phone ? I mean I need to show all images and videos from sd card. Can someone guide me

Ravi Tamada
4 years ago
Reply to  Eswar

Yes, everything is same. Just give the path of SD Card image. It should be like file:///_your_path_to_image

Eswar
Eswar
4 years ago
Reply to  Ravi Tamada

In which file? and I need to show all images from SD card. and how can i get the image paths of all images. Thanks in advance.

sam jacky
sam jacky
4 years ago

is there anyone who have download source code if so plz mail me at samjacky80@gmail.com

mohd khalid Siddiqui
mohd khalid Siddiqui
4 years ago

fullscreen image slider with swiping functionality not working

Tatenda Kabike
Tatenda Kabike
4 years ago

Great tutorial Ravi, i implemented this tutorial by replacing Glide with fresco library from facebook the performance still good, i would want to know which image library is better between Glide and Fresco,

Purushottam Kumar
Purushottam Kumar
4 years ago

Hello Ravi Nice one but i want add zoom in and zoom out in the lage image pls help me ASAP ; Thanks For this Nice example

Umrbek Bekchanov
Umrbek Bekchanov
4 years ago

Ravi how i can download your json create php file. Please send us your json create file

480
0
Would love your thoughts, please comment.x
()
x