Android - Paged ListActivity that pages horizontally

I have a list activity that implements Runnable, so my data fetch is done with a progress bar. Data is retrieved from the web service. Right now, I get all users, but I would like to change it so that it receives users one page at a time, and not right away.

public class ActiveUsersActivity extends ProtectedListActivity implements Runnable {
    ProgressDialog progress;
    ArrayList<UserModel> users;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        progress = ProgressDialog.show(ActiveUsersActivity.this, "", "Loading...", true);

        Thread thread = new Thread(ActiveUsersActivity.this);
        thread.start();
    }

    @Override
    public void run() {
    //Get user data
    users = MyService.GetAllUsers();
    }
}

So, the changes I need to make is to change the run to get one page at a time. It's easy enough, but my problem is how to make the actual horizontal swipe. Ideally, I would like to make the list slide left or right, like on home screens when you make swipe. Any ideas on how to do this?

+3
source share
1

, GestureDetector? OnGestureListener onFling.

+1

Source: https://habr.com/ru/post/1795260/


All Articles