Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swipe between activities like SnapChat?

I am developing an application which have multiple activities and I want to implement swipe(left,right,up,down) Transition between activities(Not fragments) like snapchat does.I did some research but I was failed to find a proper approach.Can anyone suggest how can I approach for above situation?Thank You.

like image 996
Sanju Talreja Avatar asked Dec 11 '22 00:12

Sanju Talreja


1 Answers

I don't believe you can get the same smooth swipe by using activities. (Someone feel free to correct me). You could capture the swipe manually and load the next activity. You wouldn't see a 'Preview' and it would be very similar to just clicking a button.

The smoothness that a view pager provides is due to fragments. Again (if I am not mistaken), only one activity can be presented to the user at a time. So you can't show a preview of the next activity. Fragments gets around this because you can have multiple fragments.

I am not sure if you have a strong reason to not use fragments. They are pretty straight forward to use and you more or less can still use activities. You would have a fragment per activity.

So although I don't want to side-step answering the question when you want to use activities but I don't believe you will be able to continue using activities and get the desired results. You will have an easier time using fragments than trying to customize the functionality with activities.

http://developer.android.com/training/animation/screen-slide.html

http://developer.android.com/training/implementing-navigation/lateral.html

How to change activity with left-right swipe

Update: Android - 2 Activities active at the same time

Wanted to verify you can't have 2 activities at the same time. So no matter what your going to have to split the functionality out of a single activity to do this. Although you 'can' do this without fragments, you will end up with a complicated solution. I would suggest using what Android provides and converting it to fragments. Its pretty straight forward.

like image 169
Kalel Wade Avatar answered Jan 25 '23 07:01

Kalel Wade