Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Get the Next and previous list items from a listview in android

I have a listview Containing some listitems similar to twitter tweets.When i clicked on a particular listitem,it shows the details of the that particular list item.

On that activity,there contains two buttons for showing "next" listitems details and "prev" listitem details.

Problem: How to show the "prev" listitem(by clicking prev button) and "next" listitem(by clicking next button) on that particular activity using view flipper.How can get the Listitem details from the main activity to this activity?

like image 837
KP_ Avatar asked Dec 21 '22 04:12

KP_


1 Answers

   **Next :**
   int position,last;
   position=listView.getCheckedItemPosition();
   position=position + 1;
   listView.getItemAtPosition(position);
   last=listView.getLastVisiblePosition()
  if(position==last)
     {
       System.out.println("Next is Impossilble");
     }

  **Previous:**
   int position;
   position=listView.getCheckedItemPosition();
   position=position - 1;
   listView.getItemAtPosition(position);
   last=listView.getLastVisiblePosition()
  if(position==1)
     {
       System.out.println("previous is Impossilble");
like image 176
selvaiyyamperumal Avatar answered Dec 23 '22 17:12

selvaiyyamperumal