I am new to Android development. I am creating an application with Fragments. Following is the Diagram.

Home screen is having the root access to all the other screens. Sales is a ViewPager and all the other screens after sales are part of it. User can slide and access.
But I do have a problem. I am planning to use one FragmentActivity for this application. It is the Home. Home screen is a collection of buttons, with images. If the user click on 'Sales' button then the Home screen flips just like ViewPager animation and access Sales screen; if the user click on 'TimeManager' button then the Home screen flips just like ViewPager animation and access TimeManager screen and so on.
Following is the code of the HomeScreen
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.home);
}
Now imagine I am in Sales screen. As I mentioned earlier, it has sequence of pages (New Lead and EditInfo) where the user can access by sliding. So it should be a ViewPager.
Based on the above information, I have to ask 2 questions.
While in
Homescreen, how user can click on the button and make the screen slide to access the next screen? When the user is in next screen (ex: To Do List) I prefer to let him slide right to go back to theHomescreen. If this is not possible, at least pressing back button should do the sliding. How can I do this?This contains application only one
FragmentActivityand theFragmentActivityclass contains the UI of Home screen. So where should I put theViewPagerofSalesscreen?Salesis aFragmentand notFragmentActivity. So how can I facilitate it to navigate to NewLead and Edit Info pages via ViewPager?
Please help.
UPDATE
Since I am adviced to use a Fragment for ViewPager I would like to know whether it is best to create a seperate fragment for ViewPager. Below is the code. What is your advice?
public class ViewPagerManager extends Fragment{
private static final int ITEMS = 2;
private ViewPager viewPager;
private MyAdapter pageAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_leads_and_sales_handling);
viewPager = (ViewPager)findViewById(R.id.pager);
pageAdapter = new MyAdapter(getSupportFragmentManager());
viewPager.setAdapter(pageAdapter);
}
private class MyAdapter extends FragmentPagerAdapter {
public MyAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
}
@Override
public int getCount() {
return ITEMS;
}
@Override
public Fragment getItem(int position) {
if(position==0)
{
return new SalesInqury();
}
else
{
return new NewLead();
}
}
}
}