5

In my app I have a listview with news items showing only a summary, and when the user clicks on an item I switch to a new activity showing the full article in a webview. The user can go back to the list by pressing the return button, but I would like to make it possible to use a swype gesture too.

Now I have discovered the ViewFlipper, but I am in doubt of when to use it correctly. If I have understood it correctly, the ViewFlipper allows the user to loop through a series of views. So theoretically, a whole app could be made in only one activity and a viewflipper consisting of the different views needed. Of course, in most cases that wouldn't make sense.

Is there a rule of thumb of when to use a ViewFlipper or when to start new activities? In my specific case with the news app, would it be a candidate for a ViewFlipper (the details view in the same activity) or should I just stick to my current setup?

Also, I have got the idea that a ViewFlipper makes it easier to switch between screens using touch events (sliding between the views), is that correct?

An example of what I would like to achieve is how the app BeyondPod switches between screens using swype gestures.

marlar
  • 3,858
  • 6
  • 37
  • 60

1 Answers1

1

Using one activity with view flipper is very costly if you have more than 3-4 screens and complex layouts. One activity will initialize all view in view flipper and uses more resources. You can use activities and achieve any kind of animations for transitions or switching activities. Make activity light weight so that it will load fast use background tasks to do queries so that activities load fast.

om252345
  • 2,395
  • 4
  • 29
  • 31
  • 1
    Is it also possible to switch between the activities so one activity slides seamlessly over to the new one? In other words, so you halfway see half of the first activity and half of the next activity? – marlar Jul 17 '11 at 20:24
  • 1
    1) It is possible to make activity switching seamless. If your activity is light weight or you made loading of activity light weight by making onCreate light weight and adding other stuff to onStart or using any Background task.. 2) I guess it is not possible to make half of one activity and half of other activity visible as when you head to another activity then either onPause or onDestroy is called and they will invalidate views of your activity... In ViewFlipper it is visible as it is in same activity. – om252345 Jul 17 '11 at 20:32