How can I implement idle timeout in android?

How can I implement an infinite scroll view in Android 2.2?

  • I need to implement an horizontal gallery with infinite scroll to the left and to the right (circular). What can the the best approach to do this using Android 2.2 with and API 8? Thanks in advance for your help.

  • Answer:

    Android has a Gallery component. But I wouldn't recommend using that one, because it's a) - deprecated, b) - not optimized for infinite scrolling. Yet, it's code might give you some insights. What I would recommend though - is to look into RecyclerView (https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html). RecyclerView is perfectly suitable for infinite scrolling and will give you lots of stuff for free (like animations). If it's default LinearLayout manager does not do the job for you you will probably have to write your own. As a matter of fact I have just last week finished writing a horizontally scrolling gallery-like custom layout manager for the company I work at using a custom LayoutManager. Can't say it was a breeze, but nothing extraordinary too. I found this blogĀ  http://wiresareobsolete.com/2014/09/building-a-recyclerview-layoutmanager-part-1/ to be extremely helpful to get started. "Circularity" though is something you would need to implement in your adapter of course.

Alexander Osmanov at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.