An attempt to achieve a dynamic interface with facebook as a sliding menu and actionbarsherlock . First, I look at the Android documentation, which introduces a fragment for processing a dynamic button. But without luck and a week, I still canโt get it to work anyway, I think this is my misunderstanding in the Android concept. The sliding panel and actionbarsherlock work without problems.
I have a HomeScreen.java that contains all of my menus and a pre-configuration step and so far I have created pagerAdapter1.java that extends FragmentPagerAdapter, and three examples of the fragment class that handle my work, which is task1.java, task2.java task3.java is quite simple
here is part of my HomeScreen.java code
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; import com.slidingmenu.lib.SlidingMenu; import com.slidingmenu.lib.app.SlidingFragmentActivity; public class HomeScreen extends SlidingFragmentActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_screen); setBehindContentView(R.layout.menu_frame); }
PagerAdapter1.java
public class PagerAdapter1 extends FragmentPagerAdapter { private List<Fragment> fragments; public PagerAdapter1(FragmentManager fm, List<Fragment> fragments) { super(fm); this.fragments = fragments; } public Fragment getItem(int position) { return this.fragments.get(position); } public int getCount() { return this.fragments.size(); } }
and three task1.java, 2,3
import android.support.v4.app.Fragment; public class Tab1Fragment extends Fragment{ onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle) public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { return null; } return (LinearLayout)inflater.inflate(R.layout.tab_frag1_layout, container, false); }
I think itโs better to explain my image problem
The home screen, which is the stage of presetting, whenever the user clicks on the menu, this page will change to the desired page.

and this is my menu

My problem is how to include this 3 fragment in my desktop? I tried so many tutorials, but this does not work in my situation. Most tutorials create a code snippet, I just want to include my 3 tasks in it