tags:

views:

63

answers:

1

Hi,

I have developed a simple android application, which when started opens a Timer. User is given two buttons, start/ pause. This is working fine. What i want to do is to add a way to support multiple timers when a user swipes his finger on the screen. When he swipes from left to right, a new timer should show up, but the previous timer should not stop. This is a way to add multiple timers. Also, when he swipes from right to left, i want a previous timer to show.

This is what i have done so for. I have a timer activity. I have added a touch event on it. When, a person swipes his finger, i get the co-ordinates and decide whether its from left to right or right to left. This funtionality is working fine, as i can see the appropriate log messages.

The problem is when im trying to load Timer Activity. It just loads the previous Activity and doesnt really create a new one (I figured this from the timer). Is there any way to do it?

+1  A: 

There already exists ViewFlipper, that has codes to switch between views.

You should create a ViewFlipper and have your layout in that, this way you end up with one single activity having multiple views.

Pentium10
I want to create a new Timer Activity and not just change the view. Using ViewFlipper will just impose a new Layout on the existing screen and wont really start a "new" timer.
Chander Shivdasani
Create an array of timers, and you just hold the reference for them. Your activities can be closed by the system any time you lose their focus to gain memory. You can't be sure they will be there when you come back.
Pentium10