Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7982193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:36:23+00:00 2026-06-04T10:36:23+00:00

In my android app I have this scenario – I have a Gallery where

  • 0

In my android app I have this scenario –
I have a Gallery where I have to display some images.
I have a total of 13 images each of which I get by calling a function with some parameters.

Now in my adapter for gallery I can only pass 7 images at a time and when the user scrolls through the gallery I should update the gallery items.
eg. My images are {0,1,2,3,4,5,6,7,8,9,10,11,12}.

First time I can only get and show {3,4,5,6,7,8,9} with 6 at center-display
now if the user scrolls rightwards I want to remove 3 from the left end and add 10 at the right end so that the adapter array becomes {4,5,6,7,8,9,10} with 7 at center and so on.

Similarly if the user scrolls leftward i want to remove 9 from right end and add 2 at the left end so that the adapter array becomes {2,3,4,5,6,7,8} with 5 at the center.

I am using LinkedList for storing my items

How can I achieve this.
Please Help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:36:25+00:00Added an answer on June 4, 2026 at 10:36 am

    Just use a custom class extends Gallery, Override onFling() detect gesture(left or right) and do your operation of removing.

    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        if (Math.abs(velocityX) > Math.abs(velocityY)) {
            // This is an horizontal fling
                if (velocityX < 0) {
                    // From left to right => go forward 
                    //  remove 3
                    return true;
                } else if (velocityX > 0) {
                    // From right to left => go backward
                    //  remove 7
                    return true;
                }
        } else {
            // This is a vertical fling
        }
    
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my app.js file in android and an images folder
I have an Android app which includes an activity called Help This uses a
I have a custom global class which looks like this import android.app.Application; public class
Hello i have this Json output and i am calling in my android app.
I have this android app that posts (http post) some data strings to my
I have this code: package org.example.Threading; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Message;
I have this code: package com.powergroupbd.timer; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.CountDownTimer;
I have read this thread FATAL EXCEPTION main Android App and it is very
I have an xml layout for a Fragment (android.support.v4.app.Fragment). When this Fragment is added
i have this code package com.tct.soundTouch; import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.MotionEvent;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.