开发者

Android - Paged ListActivity that pages on horizontal swipe

I have a list activity that implements Runnable so that my data fetch is done with a progress bar. The data is pulled from a web service. Right now, I go get all of the users, but I would like to change it so it retrieves the users one page at a time, instead of all at once.

public class ActiveUsersActivity extends ProtectedListActivity implements Runnable 开发者_如何学JAVA{
    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 modifications I need to make are to change run to get one page at a time. That is easy enough, but my problem lies in how to do the actual horizontal swipe. Ideally, I would like to make the list slide left or right like the home screens do when you do a swipe. Any ideas on how to do this?


As for the swiping, have you looked at the GestureDetector? Check out the OnGestureListener and its onFling.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜