Search in sources :

Example 1 with SampleFragment

use of com.dianping.example.fragment.SampleFragment in project AndroidDynamicLoader by mmin18.

the class FragmentDeveloper method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout rootView = new FrameLayout(this);
    rootView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    rootView.setId(android.R.id.primary);
    setContentView(rootView);
    if (savedInstanceState == null) {
        Fragment f = new SampleFragment();
        FragmentManager fm = getFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        ft.add(android.R.id.primary, f);
        ft.commit();
    }
}
Also used : FragmentManager(android.app.FragmentManager) SampleFragment(com.dianping.example.fragment.SampleFragment) FragmentTransaction(android.app.FragmentTransaction) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) Fragment(android.app.Fragment) SampleFragment(com.dianping.example.fragment.SampleFragment)

Aggregations

Fragment (android.app.Fragment)1 FragmentManager (android.app.FragmentManager)1 FragmentTransaction (android.app.FragmentTransaction)1 ViewGroup (android.view.ViewGroup)1 FrameLayout (android.widget.FrameLayout)1 SampleFragment (com.dianping.example.fragment.SampleFragment)1