PageList.size is always zero





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







8















Actually, I am new to Paging Library. Here is situation, i'm observing PagedList from my ViewModel which is always returning zero even news list appeared on UI.



 viewModel.getNews().observe(this, news -> {
swipeRefreshLayout.setRefreshing(false);
Timber.d("news size is %s",news.size());// **news size is 0**
adapter.submitList(news);
});


My DataSource is



public class NewsDataSource extends ItemKeyedDataSource<String, News> {

private MutableLiveData<Resource.Status> netStatusLive = new MutableLiveData<>();

/*Hide Logic for clean purpose*/

private List<News> localNewsList = new ArrayList<>();

public NewsDataSource( /*Hide Logic for clean purpose*/) {
/*Hide Logic for clean purpose*/
}


@Override
public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull LoadInitialCallback<News> callback) {
netStatusLive.postValue(Resource.Status.LOADING);
localNewsList.clear();
Disposable disposable = /*Hide Logic for clean purpose*/

compositeDisposable.add(disposable);
}

@Override
public void loadAfter(@NonNull LoadParams<String> params, @NonNull LoadCallback<News> callback) {
if (localNewsList.size() > 19) {
netStatusLive.postValue(Resource.Status.LOADING);
Disposable disposable = /*Hide Logic for clean purpose*/
compositeDisposable.add(disposable);
}

}

private String getLastIdOfNews(List<News> localNewsList) {
if (localNewsList.size() <= 0) {
return "android";
} else {
return localNewsList.get(localNewsList.size() - 1).getId();
}
}

@Override
public void loadBefore(@NonNull LoadParams<String> params, @NonNull LoadCallback<News> callback) {
//do nothing...
}

@NonNull
@Override
public String getKey(@NonNull News item) {
return item.getId();
}

private void onPaginationError(Throwable throwable) {
netStatusLive.postValue(Resource.Status.ERROR);
Timber.e(throwable);
}

public LiveData<Resource.Status> getNetworkState() {
return netStatusLive;
}

}


In this case localNewsList is require to give last id of News on loadAfter which is like



Observable<List<News>> getNewsList(@Query("skip") int skip,
@Query("limit") int limit,
@Query("lastNewsId") String lastNewsId);


My DataSourceFactory is



    public class NewsDataSourceFactory extends DataSource.Factory<String, Journal> {
private MutableLiveData<JournalDataSource> dataSourceLive = new MutableLiveData<>();

/*Hide Logic for clean purpose*/

public NewsDataSourceFactory( /*Hide Logic for clean purpose*/) {
/*Hide Logic for clean purpose*/
}

@Override
public DataSource<String, Journal> create() {
JournalDataSource dataSource = new JournalDataSource( /*Hide Logic for clean purpose*/);
dataSourceLive.postValue(dataSource);
return dataSource;

}
public void prepareData(String coursId, String studnetId) {
this.coursId = coursId;
this.studnetId = studnetId;
}


public MutableLiveData<JournalDataSource> getDataSource() {
return dataSourceLive;
}
}


ViewModle is



public class NewsViewModel extends ViewModel {

private LiveData<PagedList<News>> newslist = new MutableLiveData<>();
private LiveData<Resource.Status> networkState = new MutableLiveData<>();

private NewsDataSourceFactory factory;

private PagedList.Config config;

private Executor executor;


NewsViewModel(NewsDataSourceFactory factory, PagedList.Config config) {
this.factory = factory;
this.config = config;

executor = Executors.newFixedThreadPool(5);


networkState = Transformations.switchMap(factory.getDataSource(), source -> {
Timber.d("network status get");
return source.getNetworkState();
}
);
}

public void getNews(String courseId, String studentId) {
//Newss = repo.getNewss(auth, courseId, studentId, 0, 20, "android");
factory.prepareData(courseId, studentId);
newslist = new LivePagedListBuilder<>(factory, config).setFetchExecutor(executor).build();
}

public void refresh() {
factory.getDataSource().getValue().invalidate();
}

public LiveData<PagedList<News>> getNews() {
return newslist;
}

public LiveData<Resource.Status> getNetworkState() {
return networkState;
}


I think, my problem may be mismatch my datasource use case and my datasource type.So PageList doesn't work properly as we expected.










share|improve this question

























  • not quite sure but can u please change the %s to %d ... and check

    – Solaiman Hossain
    Oct 30 '18 at 4:45











  • Thanks you for answering. I tried.But I thinks it doesn't deal with my situation.

    – Lwin Myo Aung
    Oct 30 '18 at 5:10













  • Can you post your Factory class

    – Ümañg ßürmån
    Nov 8 '18 at 17:12











  • @Ümañgßürmån I updated

    – Lwin Myo Aung
    Nov 9 '18 at 3:07











  • can you add your ViewModel ?

    – Zwal Pyae Kyaw
    Nov 12 '18 at 7:42


















8















Actually, I am new to Paging Library. Here is situation, i'm observing PagedList from my ViewModel which is always returning zero even news list appeared on UI.



 viewModel.getNews().observe(this, news -> {
swipeRefreshLayout.setRefreshing(false);
Timber.d("news size is %s",news.size());// **news size is 0**
adapter.submitList(news);
});


My DataSource is



public class NewsDataSource extends ItemKeyedDataSource<String, News> {

private MutableLiveData<Resource.Status> netStatusLive = new MutableLiveData<>();

/*Hide Logic for clean purpose*/

private List<News> localNewsList = new ArrayList<>();

public NewsDataSource( /*Hide Logic for clean purpose*/) {
/*Hide Logic for clean purpose*/
}


@Override
public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull LoadInitialCallback<News> callback) {
netStatusLive.postValue(Resource.Status.LOADING);
localNewsList.clear();
Disposable disposable = /*Hide Logic for clean purpose*/

compositeDisposable.add(disposable);
}

@Override
public void loadAfter(@NonNull LoadParams<String> params, @NonNull LoadCallback<News> callback) {
if (localNewsList.size() > 19) {
netStatusLive.postValue(Resource.Status.LOADING);
Disposable disposable = /*Hide Logic for clean purpose*/
compositeDisposable.add(disposable);
}

}

private String getLastIdOfNews(List<News> localNewsList) {
if (localNewsList.size() <= 0) {
return "android";
} else {
return localNewsList.get(localNewsList.size() - 1).getId();
}
}

@Override
public void loadBefore(@NonNull LoadParams<String> params, @NonNull LoadCallback<News> callback) {
//do nothing...
}

@NonNull
@Override
public String getKey(@NonNull News item) {
return item.getId();
}

private void onPaginationError(Throwable throwable) {
netStatusLive.postValue(Resource.Status.ERROR);
Timber.e(throwable);
}

public LiveData<Resource.Status> getNetworkState() {
return netStatusLive;
}

}


In this case localNewsList is require to give last id of News on loadAfter which is like



Observable<List<News>> getNewsList(@Query("skip") int skip,
@Query("limit") int limit,
@Query("lastNewsId") String lastNewsId);


My DataSourceFactory is



    public class NewsDataSourceFactory extends DataSource.Factory<String, Journal> {
private MutableLiveData<JournalDataSource> dataSourceLive = new MutableLiveData<>();

/*Hide Logic for clean purpose*/

public NewsDataSourceFactory( /*Hide Logic for clean purpose*/) {
/*Hide Logic for clean purpose*/
}

@Override
public DataSource<String, Journal> create() {
JournalDataSource dataSource = new JournalDataSource( /*Hide Logic for clean purpose*/);
dataSourceLive.postValue(dataSource);
return dataSource;

}
public void prepareData(String coursId, String studnetId) {
this.coursId = coursId;
this.studnetId = studnetId;
}


public MutableLiveData<JournalDataSource> getDataSource() {
return dataSourceLive;
}
}


ViewModle is



public class NewsViewModel extends ViewModel {

private LiveData<PagedList<News>> newslist = new MutableLiveData<>();
private LiveData<Resource.Status> networkState = new MutableLiveData<>();

private NewsDataSourceFactory factory;

private PagedList.Config config;

private Executor executor;


NewsViewModel(NewsDataSourceFactory factory, PagedList.Config config) {
this.factory = factory;
this.config = config;

executor = Executors.newFixedThreadPool(5);


networkState = Transformations.switchMap(factory.getDataSource(), source -> {
Timber.d("network status get");
return source.getNetworkState();
}
);
}

public void getNews(String courseId, String studentId) {
//Newss = repo.getNewss(auth, courseId, studentId, 0, 20, "android");
factory.prepareData(courseId, studentId);
newslist = new LivePagedListBuilder<>(factory, config).setFetchExecutor(executor).build();
}

public void refresh() {
factory.getDataSource().getValue().invalidate();
}

public LiveData<PagedList<News>> getNews() {
return newslist;
}

public LiveData<Resource.Status> getNetworkState() {
return networkState;
}


I think, my problem may be mismatch my datasource use case and my datasource type.So PageList doesn't work properly as we expected.










share|improve this question

























  • not quite sure but can u please change the %s to %d ... and check

    – Solaiman Hossain
    Oct 30 '18 at 4:45











  • Thanks you for answering. I tried.But I thinks it doesn't deal with my situation.

    – Lwin Myo Aung
    Oct 30 '18 at 5:10













  • Can you post your Factory class

    – Ümañg ßürmån
    Nov 8 '18 at 17:12











  • @Ümañgßürmån I updated

    – Lwin Myo Aung
    Nov 9 '18 at 3:07











  • can you add your ViewModel ?

    – Zwal Pyae Kyaw
    Nov 12 '18 at 7:42














8












8








8


1






Actually, I am new to Paging Library. Here is situation, i'm observing PagedList from my ViewModel which is always returning zero even news list appeared on UI.



 viewModel.getNews().observe(this, news -> {
swipeRefreshLayout.setRefreshing(false);
Timber.d("news size is %s",news.size());// **news size is 0**
adapter.submitList(news);
});


My DataSource is



public class NewsDataSource extends ItemKeyedDataSource<String, News> {

private MutableLiveData<Resource.Status> netStatusLive = new MutableLiveData<>();

/*Hide Logic for clean purpose*/

private List<News> localNewsList = new ArrayList<>();

public NewsDataSource( /*Hide Logic for clean purpose*/) {
/*Hide Logic for clean purpose*/
}


@Override
public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull LoadInitialCallback<News> callback) {
netStatusLive.postValue(Resource.Status.LOADING);
localNewsList.clear();
Disposable disposable = /*Hide Logic for clean purpose*/

compositeDisposable.add(disposable);
}

@Override
public void loadAfter(@NonNull LoadParams<String> params, @NonNull LoadCallback<News> callback) {
if (localNewsList.size() > 19) {
netStatusLive.postValue(Resource.Status.LOADING);
Disposable disposable = /*Hide Logic for clean purpose*/
compositeDisposable.add(disposable);
}

}

private String getLastIdOfNews(List<News> localNewsList) {
if (localNewsList.size() <= 0) {
return "android";
} else {
return localNewsList.get(localNewsList.size() - 1).getId();
}
}

@Override
public void loadBefore(@NonNull LoadParams<String> params, @NonNull LoadCallback<News> callback) {
//do nothing...
}

@NonNull
@Override
public String getKey(@NonNull News item) {
return item.getId();
}

private void onPaginationError(Throwable throwable) {
netStatusLive.postValue(Resource.Status.ERROR);
Timber.e(throwable);
}

public LiveData<Resource.Status> getNetworkState() {
return netStatusLive;
}

}


In this case localNewsList is require to give last id of News on loadAfter which is like



Observable<List<News>> getNewsList(@Query("skip") int skip,
@Query("limit") int limit,
@Query("lastNewsId") String lastNewsId);


My DataSourceFactory is



    public class NewsDataSourceFactory extends DataSource.Factory<String, Journal> {
private MutableLiveData<JournalDataSource> dataSourceLive = new MutableLiveData<>();

/*Hide Logic for clean purpose*/

public NewsDataSourceFactory( /*Hide Logic for clean purpose*/) {
/*Hide Logic for clean purpose*/
}

@Override
public DataSource<String, Journal> create() {
JournalDataSource dataSource = new JournalDataSource( /*Hide Logic for clean purpose*/);
dataSourceLive.postValue(dataSource);
return dataSource;

}
public void prepareData(String coursId, String studnetId) {
this.coursId = coursId;
this.studnetId = studnetId;
}


public MutableLiveData<JournalDataSource> getDataSource() {
return dataSourceLive;
}
}


ViewModle is



public class NewsViewModel extends ViewModel {

private LiveData<PagedList<News>> newslist = new MutableLiveData<>();
private LiveData<Resource.Status> networkState = new MutableLiveData<>();

private NewsDataSourceFactory factory;

private PagedList.Config config;

private Executor executor;


NewsViewModel(NewsDataSourceFactory factory, PagedList.Config config) {
this.factory = factory;
this.config = config;

executor = Executors.newFixedThreadPool(5);


networkState = Transformations.switchMap(factory.getDataSource(), source -> {
Timber.d("network status get");
return source.getNetworkState();
}
);
}

public void getNews(String courseId, String studentId) {
//Newss = repo.getNewss(auth, courseId, studentId, 0, 20, "android");
factory.prepareData(courseId, studentId);
newslist = new LivePagedListBuilder<>(factory, config).setFetchExecutor(executor).build();
}

public void refresh() {
factory.getDataSource().getValue().invalidate();
}

public LiveData<PagedList<News>> getNews() {
return newslist;
}

public LiveData<Resource.Status> getNetworkState() {
return networkState;
}


I think, my problem may be mismatch my datasource use case and my datasource type.So PageList doesn't work properly as we expected.










share|improve this question
















Actually, I am new to Paging Library. Here is situation, i'm observing PagedList from my ViewModel which is always returning zero even news list appeared on UI.



 viewModel.getNews().observe(this, news -> {
swipeRefreshLayout.setRefreshing(false);
Timber.d("news size is %s",news.size());// **news size is 0**
adapter.submitList(news);
});


My DataSource is



public class NewsDataSource extends ItemKeyedDataSource<String, News> {

private MutableLiveData<Resource.Status> netStatusLive = new MutableLiveData<>();

/*Hide Logic for clean purpose*/

private List<News> localNewsList = new ArrayList<>();

public NewsDataSource( /*Hide Logic for clean purpose*/) {
/*Hide Logic for clean purpose*/
}


@Override
public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull LoadInitialCallback<News> callback) {
netStatusLive.postValue(Resource.Status.LOADING);
localNewsList.clear();
Disposable disposable = /*Hide Logic for clean purpose*/

compositeDisposable.add(disposable);
}

@Override
public void loadAfter(@NonNull LoadParams<String> params, @NonNull LoadCallback<News> callback) {
if (localNewsList.size() > 19) {
netStatusLive.postValue(Resource.Status.LOADING);
Disposable disposable = /*Hide Logic for clean purpose*/
compositeDisposable.add(disposable);
}

}

private String getLastIdOfNews(List<News> localNewsList) {
if (localNewsList.size() <= 0) {
return "android";
} else {
return localNewsList.get(localNewsList.size() - 1).getId();
}
}

@Override
public void loadBefore(@NonNull LoadParams<String> params, @NonNull LoadCallback<News> callback) {
//do nothing...
}

@NonNull
@Override
public String getKey(@NonNull News item) {
return item.getId();
}

private void onPaginationError(Throwable throwable) {
netStatusLive.postValue(Resource.Status.ERROR);
Timber.e(throwable);
}

public LiveData<Resource.Status> getNetworkState() {
return netStatusLive;
}

}


In this case localNewsList is require to give last id of News on loadAfter which is like



Observable<List<News>> getNewsList(@Query("skip") int skip,
@Query("limit") int limit,
@Query("lastNewsId") String lastNewsId);


My DataSourceFactory is



    public class NewsDataSourceFactory extends DataSource.Factory<String, Journal> {
private MutableLiveData<JournalDataSource> dataSourceLive = new MutableLiveData<>();

/*Hide Logic for clean purpose*/

public NewsDataSourceFactory( /*Hide Logic for clean purpose*/) {
/*Hide Logic for clean purpose*/
}

@Override
public DataSource<String, Journal> create() {
JournalDataSource dataSource = new JournalDataSource( /*Hide Logic for clean purpose*/);
dataSourceLive.postValue(dataSource);
return dataSource;

}
public void prepareData(String coursId, String studnetId) {
this.coursId = coursId;
this.studnetId = studnetId;
}


public MutableLiveData<JournalDataSource> getDataSource() {
return dataSourceLive;
}
}


ViewModle is



public class NewsViewModel extends ViewModel {

private LiveData<PagedList<News>> newslist = new MutableLiveData<>();
private LiveData<Resource.Status> networkState = new MutableLiveData<>();

private NewsDataSourceFactory factory;

private PagedList.Config config;

private Executor executor;


NewsViewModel(NewsDataSourceFactory factory, PagedList.Config config) {
this.factory = factory;
this.config = config;

executor = Executors.newFixedThreadPool(5);


networkState = Transformations.switchMap(factory.getDataSource(), source -> {
Timber.d("network status get");
return source.getNetworkState();
}
);
}

public void getNews(String courseId, String studentId) {
//Newss = repo.getNewss(auth, courseId, studentId, 0, 20, "android");
factory.prepareData(courseId, studentId);
newslist = new LivePagedListBuilder<>(factory, config).setFetchExecutor(executor).build();
}

public void refresh() {
factory.getDataSource().getValue().invalidate();
}

public LiveData<PagedList<News>> getNews() {
return newslist;
}

public LiveData<Resource.Status> getNetworkState() {
return networkState;
}


I think, my problem may be mismatch my datasource use case and my datasource type.So PageList doesn't work properly as we expected.







android android-architecture-components android-jetpack android-paging






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 7:48







Lwin Myo Aung

















asked Oct 30 '18 at 4:25









Lwin Myo AungLwin Myo Aung

468320




468320













  • not quite sure but can u please change the %s to %d ... and check

    – Solaiman Hossain
    Oct 30 '18 at 4:45











  • Thanks you for answering. I tried.But I thinks it doesn't deal with my situation.

    – Lwin Myo Aung
    Oct 30 '18 at 5:10













  • Can you post your Factory class

    – Ümañg ßürmån
    Nov 8 '18 at 17:12











  • @Ümañgßürmån I updated

    – Lwin Myo Aung
    Nov 9 '18 at 3:07











  • can you add your ViewModel ?

    – Zwal Pyae Kyaw
    Nov 12 '18 at 7:42



















  • not quite sure but can u please change the %s to %d ... and check

    – Solaiman Hossain
    Oct 30 '18 at 4:45











  • Thanks you for answering. I tried.But I thinks it doesn't deal with my situation.

    – Lwin Myo Aung
    Oct 30 '18 at 5:10













  • Can you post your Factory class

    – Ümañg ßürmån
    Nov 8 '18 at 17:12











  • @Ümañgßürmån I updated

    – Lwin Myo Aung
    Nov 9 '18 at 3:07











  • can you add your ViewModel ?

    – Zwal Pyae Kyaw
    Nov 12 '18 at 7:42

















not quite sure but can u please change the %s to %d ... and check

– Solaiman Hossain
Oct 30 '18 at 4:45





not quite sure but can u please change the %s to %d ... and check

– Solaiman Hossain
Oct 30 '18 at 4:45













Thanks you for answering. I tried.But I thinks it doesn't deal with my situation.

– Lwin Myo Aung
Oct 30 '18 at 5:10







Thanks you for answering. I tried.But I thinks it doesn't deal with my situation.

– Lwin Myo Aung
Oct 30 '18 at 5:10















Can you post your Factory class

– Ümañg ßürmån
Nov 8 '18 at 17:12





Can you post your Factory class

– Ümañg ßürmån
Nov 8 '18 at 17:12













@Ümañgßürmån I updated

– Lwin Myo Aung
Nov 9 '18 at 3:07





@Ümañgßürmån I updated

– Lwin Myo Aung
Nov 9 '18 at 3:07













can you add your ViewModel ?

– Zwal Pyae Kyaw
Nov 12 '18 at 7:42





can you add your ViewModel ?

– Zwal Pyae Kyaw
Nov 12 '18 at 7:42












1 Answer
1






active

oldest

votes


















0














According to Android Paging Library Doc, You should call Api synchronous !
If you use RxRetrofit just remove observeOn() and subscribeOn() to run api on current thread that paging library use .
I tested it and it works fine for me .






share|improve this answer



















  • 1





    Thank you!. It worked. However, It respond only one time to observer( currently viewModel.getNews().observe(this, news -> { Timber.d("news size is %s",news.size());// **news size is 20** //..... });. The things I need is , when i scrolled the list, it should show ,40, 60, and so on ..

    – Lwin Myo Aung
    Nov 27 '18 at 3:11












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53057418%2fpagelist-size-is-always-zero%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














According to Android Paging Library Doc, You should call Api synchronous !
If you use RxRetrofit just remove observeOn() and subscribeOn() to run api on current thread that paging library use .
I tested it and it works fine for me .






share|improve this answer



















  • 1





    Thank you!. It worked. However, It respond only one time to observer( currently viewModel.getNews().observe(this, news -> { Timber.d("news size is %s",news.size());// **news size is 20** //..... });. The things I need is , when i scrolled the list, it should show ,40, 60, and so on ..

    – Lwin Myo Aung
    Nov 27 '18 at 3:11
















0














According to Android Paging Library Doc, You should call Api synchronous !
If you use RxRetrofit just remove observeOn() and subscribeOn() to run api on current thread that paging library use .
I tested it and it works fine for me .






share|improve this answer



















  • 1





    Thank you!. It worked. However, It respond only one time to observer( currently viewModel.getNews().observe(this, news -> { Timber.d("news size is %s",news.size());// **news size is 20** //..... });. The things I need is , when i scrolled the list, it should show ,40, 60, and so on ..

    – Lwin Myo Aung
    Nov 27 '18 at 3:11














0












0








0







According to Android Paging Library Doc, You should call Api synchronous !
If you use RxRetrofit just remove observeOn() and subscribeOn() to run api on current thread that paging library use .
I tested it and it works fine for me .






share|improve this answer













According to Android Paging Library Doc, You should call Api synchronous !
If you use RxRetrofit just remove observeOn() and subscribeOn() to run api on current thread that paging library use .
I tested it and it works fine for me .







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 26 '18 at 14:38









Keyvan NorouziKeyvan Norouzi

11




11








  • 1





    Thank you!. It worked. However, It respond only one time to observer( currently viewModel.getNews().observe(this, news -> { Timber.d("news size is %s",news.size());// **news size is 20** //..... });. The things I need is , when i scrolled the list, it should show ,40, 60, and so on ..

    – Lwin Myo Aung
    Nov 27 '18 at 3:11














  • 1





    Thank you!. It worked. However, It respond only one time to observer( currently viewModel.getNews().observe(this, news -> { Timber.d("news size is %s",news.size());// **news size is 20** //..... });. The things I need is , when i scrolled the list, it should show ,40, 60, and so on ..

    – Lwin Myo Aung
    Nov 27 '18 at 3:11








1




1





Thank you!. It worked. However, It respond only one time to observer( currently viewModel.getNews().observe(this, news -> { Timber.d("news size is %s",news.size());// **news size is 20** //..... });. The things I need is , when i scrolled the list, it should show ,40, 60, and so on ..

– Lwin Myo Aung
Nov 27 '18 at 3:11





Thank you!. It worked. However, It respond only one time to observer( currently viewModel.getNews().observe(this, news -> { Timber.d("news size is %s",news.size());// **news size is 20** //..... });. The things I need is , when i scrolled the list, it should show ,40, 60, and so on ..

– Lwin Myo Aung
Nov 27 '18 at 3:11




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53057418%2fpagelist-size-is-always-zero%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen