2

I have ListView which has many items(rows), onClick of any item goes to the DetailActivity which explains more about that particular item. If I want to see the detail of the next item, I have to come back to the ListView and click next item. How to design to see the next or previous item's detail from DetailActivity by swiping it left or right.

Marcus
  • 6,697
  • 11
  • 46
  • 89
ABI
  • 1,536
  • 18
  • 38
  • http://stackoverflow.com/questions/26771651/android-new-inbox-app-style-listview-with-swipe-left-and-right it may helps you – Vaishali Sutariya Feb 26 '15 at 07:29
  • No that sliding each row in the listview, I want to do the sliding part in the next activity, I think you haven't got the question right? – ABI Feb 26 '15 at 08:45
  • I think it depends upon how long the details are. Does it need scrolling? How frequently will the user check the details? – Sufian Feb 26 '15 at 09:15
  • @Sufian, it doesn't need scrolling, its just an half page – ABI Feb 26 '15 at 09:21

2 Answers2

1

I assume that you have a Custom Object and ArrayList of this object. You need to have an adapter to Show this Arraylist into Listview When you clicked the list item you need to pass your object from ListActivity to your DetailActivity

I think you are doing this fine until this part.

Then now, you can use ViewPager and its adapter in your DetailActivity. When you click the list item, you need to pass your Arraylist and your object index to the DetailActivity.

In the DetailActivity, get your Arraylist, set your List into ViewPager adapter, find your object via index(that you clicked) and set ViewPager page index as your wanted item index.

If you manage this correctly, you can slide details of your content. You can ask ma anything to make this clear.

There is a tutorial of Using the ViewPager: http://architects.dzone.com/articles/android-tutorial-using

Oğuzhan Döngül
  • 7,856
  • 4
  • 38
  • 52
1

You could go with a ExpandableListView. No need to open a new screen or doing something which becomes hard to manage like Fragments. The user can show/hide detail just by clicking on the item.

A view that shows items in a vertically scrolling two-level list. This differs from the ListView by allowing two levels: groups which can individually be expanded to show its children. The items come from the ExpandableListAdapter associated with this view.

Sufian
  • 6,405
  • 16
  • 66
  • 120