Nasim
Nasim

Reputation: 125

How To Open Another Activity By Swiping

I am A beginner at android. I have created an app which loads news from JSON to recycler view. I want to open an activity when the user swipes from left to right. I tried different methods but it doesn't work for me. Please help.

Upvotes: 2

Views: 902

Answers (2)

Rishav Singla
Rishav Singla

Reputation: 483

The better option is to use one Activity & other Fragments. And then use Viewpager for swipe between fragments. Follow below link:

https://developer.android.com/training/animation/screen-slide

Upvotes: 0

You have to create an activity first and put a view pager in it and switch between fragments : ( its better to use fragments at this kind of situations, u can swipe between ur fragments by using android view pager )

Here is a great link that gonna help you :

https://medium.com/@kyroschow/how-to-use-viewpager-for-navigating-between-fragments-with-tablayout-a28b4cf92c42

Have a good day

Upvotes: 1

Related Questions