0

I'm making my first app but I'm not sure to the method I use. I'll try to be clear:

I have three layout files: activity_main.xml for my first screen, menu.xml for the menu, and the last content.xml for show the content the people needs.

The first (activity_main.xml) has 2 boutons: training, lessons.

When clicking on one of them it's menu.xml which come with a list of button to access to the content. When the user make his choice it's content.xml appears.

content.xml is a long LinearLayout with a lot of elements, and I make visible the elements compared at the choice to the user.

I thought make 3 layout files was simple for manage the content I have to show (menu show different buttons if the user choose lessons or training and content.xml can show a lot of different elements) but now I'm trying to make my layout files sliding on the screen when they are call but I don't know how to do, all the animation I try to do give me:

Null pointer Exception.

So I look on the internet and I see than people who make multiple layout files if for different API level and not just for make "new page". So I would like to know your view. Is it a good way to make different layout files like this ?

And if it's not a so bad idea, do you know how I can resolve my problem to slide them ? ( I tried to create object from the layout, to slide the layout file directly, but nothing works)

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
LeNomade
  • 13
  • 7

2 Answers2

1

Viewpager can be used for multiple screen that can be slide one after another.

Exapmle and Answer is here

Community
  • 1
  • 1
Ankit Kumar
  • 3,663
  • 2
  • 26
  • 38
0

Viewpager will be helpfull for this follow the link for example

https://dzone.com/articles/android-tutorial-using

Dinesh Saini
  • 335
  • 1
  • 12