S
S
SerGio13132016-11-22 21:01:29
Java
SerGio1313, 2016-11-22 21:01:29

How to get a list of random users?

It is required to get a list of random users. I use Retrofit and API from Github.

final Call<List<GithubUser>> call = service.getListOfUsers(new Random().nextInt(50));
            call.enqueue(new Callback<List<GithubUser>>() {
                @Override
                public void onResponse(Call<List<GithubUser>> call, Response<List<GithubUser>> response) {
                    if (response.isSuccessful()) {
                        //get user from response.body by random id

                    } else {}
                    }
                @Override
                public void onFailure(Call<List<GithubUser>> call, Throwable t) {}
         });
//описание запроса в apiInterface 
 @GET("/users?since")
Call<List<GithubUser>> getListOfUsers(@Query("number") int number);

Passing a number to getListOfUsers() I want to get a list of elements whose id is higher than the specified number parameter. But every time I get the same list, which does not depend on the passed parameter. Tell me, what's the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nick Smith, 2016-11-22
@SerGio1313

@Query("since") and @GET("/users")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question