Reputation: 1866
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?
Upvotes: 4
Views: 6937
Reputation: 333
**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");
Upvotes: 8
Reputation: 53657
You need to get the data from the array or arraylist whatever you are using for adapter. Adapter needs either array or list of data while creating. you can store this array or list for further access
Try with the following steps
Upvotes: 3