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.
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.
<?xml version="1.0" encoding="utf-8"?> <info.androidhive.glide.helper.SquareLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ImageView android:id="@+id/thumbnail" android:layout_width="match_parent" android:layout_height="match_parent" android:adjustViewBounds="true" android:scaleType="centerCrop" /> </info.androidhive.glide.helper.SquareLayout>
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.
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.
Hi there! I am Founder at androidhive and programming enthusiast. My skills includes Android, iOS, PHP, Ruby on Rails and lot more. If you have any idea that you would want me to develop? Let’s talk: ravi@androidhive.info
So much interesting tutorial. Thank you once again 🙂
I am glad you find it interesting.
very helpfull thanks… i try it fragment and getSupportFragmentManager make error can i use it?
Instead of getSupportFragmentManager(), try calling getFragmentManager ()
Good tutorial. Mr. Ravi Tamada. But i want to know, does glide free for commercial use?
It’s free. Open source.
good one and good change of website!! 🙂 🙂 great work
Thanks 🙂
please check the content_main.xml file .
Thanks sridhar. I updated it.
nice tutorial sir
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?
Use jackson
Thanks for reply
Peoples are eagerly waiting for Retrofit tutorial !!!
Peoples are eagerly waiting for Retrofit tutorial !
I’m getting a Volley Error, error.getMessage()-> null, error.toString()-> timeOut error.
very helpful for my project. but how can i show this images in offline? please help
very useful tutorial, thank you. What you think about Retrofit and volley which one is the best ?
Nice article…
How to import it to android studio as i can’t import it correctly
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”.
How can i set selected images as wallpaper? please help
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)……
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
I find it : compile ‘com.android.support:design:23.2.1’ compile ‘com.android.support:support-v4:23.2.1’
tks for sharing!
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?
Same problem here. It’s always a longclick, so it doesn’t go full screen. Could you be able to solve?
Please help , I have same problem
Image.java is missing under model package
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.
You need to keep a TextView in gallery_thumbnail.xml and set the value in adapter class
Please help me.. how can i save image or set as wallpaper from this?
superb
Why do I get layout like this?

you did this. super.onMeasure(widthMeasureSpec, heightMeasureSpec);
instead of super.onMeasure(widthMeasureSpec, widthMeasureSpec); in SquareLayout Class
welcome back Ravi and Congratulations for new style
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
Right click on your main package -> New -> Package
Hi sir hiw are you if u need code source contact me gismail095@gmail.com “
Hi sir hiw are you if u need code source contact me gismail095@gmail.com
!
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
It seems you forgot to AppController to manifest file. Check 5th point
Hi sir hiw are you if u need code source contact me gismail095@gmail.com ÷
its nice one
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
How you record this screen videos ?
Hi
Hi sir hiw are you if u need code source contacte me gismail095@gmail.com
The class under the model package is missing in this tutorial.
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
Hi, thank you very much! But what about zoom?
You can get the zooming functionality from this article
http://www.androidhive.info/2013/09/android-fullscreen-image-slider-with-swipe-and-pinch-zoom-gestures/
Thank you so much!
Hi sir how are you if u need cod source contact me gismail095@gmail.com
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…
Hi Ashwani
I’ll check once again. Thank You
Hi sir how are you if u need code sourc contact me gismail095@gmail.com
Hi Ravi,
fragment_image_slider.xml layout file is missing, Please help to get it.
Hi sir how are you if u need code source contact me gismail095@gmail.com
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"
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
Hi sir hiw are you if u need code source contact me gismail095@gmail.com
Error in MainActivity class (JsonConnectivity) how to clear this Json Error.
some classes are missing above the app.Then i faced most of the problem in this difficult WindowActionbar then java.lang.NullPointerException is raised.
Please kindly add the style.xml and colour.xml files to the tutorial, or upload them separately. Thanks
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.
kindly email it to me Fabio….. farashi181@stu.ui.edu.ng Thanks in Advance
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.
Is the image url you are loading is correct. Is it opening in browser?
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.
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.
Please I am having same issue
Great tuto Ravi, can you please add Download wallpaper button to download each picture ?
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
Great tuto Ravi, can you please add Download wallpaper button to download each picture ?
You can get the code of download from this article
http://www.androidhive.info/2014/08/android-building-free-wallpapers-app-part-2/
it’s not same with glide , I tried but I’m not successful
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!
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
download the code and extract and to go to respected folder to find the model.class
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
mailed bro check it
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 ..
Hello ravi can i integrate a video with this library ? kindly advice .
Glide supports Gifs and Videos.
https://futurestud.io/blog/glide-displaying-gifs-and-videos
Hello
Thank you very much but unfortunately the library load videos from local phone only , but I need to load url from Internet ?
Regards
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
Yes, everything is same. Just give the path of SD Card image. It should be like file:///_your_path_to_image
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.
is there anyone who have download source code if so plz mail me at samjacky80@gmail.com
fullscreen image slider with swiping functionality not working
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,
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
Ravi how i can download your json create php file. Please send us your json create file