0

I'm making an android app that will essentially show the user a word, definition and example for each element in the database. It's sort of like a dictionary. I have already made it so that all the words, along with their definitions and examples, have been entered into the database but now I am trying to figure out a way to display them.

What I would like is to have 3 textviews which would contain the word, definition and example respectively in a view and every time the user swipes down to go to the next word entry in the database. Every time the user swipes back I'd like the view to repopulate the textviews with the previous entry in the database.

What I'm wondering is what is the best way to do this? Is this there a particular class that deals specifically with this type of thing? Bear in mind that I don't want to switch views since I would have to make over 300 views but rather just repopulate the values of the textviews with the new values from the database. Bonus points if it's easy to make a flip/slide animation with each swipe but it's not really necessary.

user2525981
  • 159
  • 1
  • 3
  • 10

1 Answers1

0

You can use 'onFling' method. You can detect the swipe direction and with a listener for the right direction swipe, you can call your methods for the data source.

here is an example : How to detect swipe direction between left/right and up/down

Community
  • 1
  • 1
Canberk
  • 435
  • 3
  • 10
  • Sorry I should have been more specific. I have the onFling method in I'm just not sure as to how to use it to repopulate the views with new content every time someone swipes. – user2525981 Jul 27 '13 at 18:43
  • What I mean to say is that I'm not sure what the best way to update the content of the views is and I was wondering for others' opinions – user2525981 Jul 27 '13 at 18:45