Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Handle two listviews in one activity?
    primarykey
    data
    text
    <p>In my application,im using two listviews and both are not showing simultaneously.But im using the same "custom adapter class".But it is showing different results while implementing pagination.Pagination works well in the first listview which loads initially.But when i click another listview to show the results,it is not working</p> <p>My Problem: How to implement pagination in both of these listviews effectively?Is it better to use two different custom adapter class?</p> <p>Here the sample code which i done for pagination------</p> <pre><code> btnNext.setVisibility(View.VISIBLE); TotalPages = TotalPages + 1; if (pagenum == 0) { btnPrev.setVisibility(View.INVISIBLE); pagenum = pagenum + 1; } else { recentCracks = web.getAllRecentCrackUps(pagenum); if (recentCracks != null) { adapter = new DynamicListAdapter(KidsCrackMeUp.this, recentCracks); lstRecentPosts.setAdapter(adapter); } txtPageCount.setText(String.valueOf(pagenum)); txtTotalPages.setText(String.valueOf(totalpagecount)); } if (pagenum == 1) { //btnPrev.setEnabled(false); btnPrev.setVisibility(View.INVISIBLE); } } }); </code></pre> <p>//Button Previous Ends Here-----------</p> <pre><code> btnNext.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { pagenum = pagenum + 1; btnPrev.setVisibility(View.VISIBLE); TotalPages = TotalPages - 1; //btnPrev.setEnabled(true); if (TotalPages == 0) { btnNext.setEnabled(false); pagenum = pagenum - 1; } else { recentCracks = web.getAllRecentCrackUps(pagenum); if (recentCracks != null) { adapter = new DynamicListAdapter(KidsCrackMeUp.this, recentCracks); lstRecentPosts.setAdapter(adapter); } txtPageCount.setText(String.valueOf(pagenum)); txtTotalPages.setText(String.valueOf(totalpagecount)); } if (TotalPages == 1) { **strong text**// btnNext.setEnabled(false); btnNext.setVisibility(View.INVISIBLE); } } }); </code></pre> <p>//Button Next Ends Here----</p> <pre><code> } else { btnNext.setVisibility(View.GONE); } // rel.setVisibility(View.VISIBLE); lstRecentPosts.setAdapter(adapter); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload