Code example for FragmentActivity

0
package com.xufan.wirelessOrder; 
 
import android.os.Bundle; 
import android.support.v4.app.Fragment; 
import android.support.v4.app.FragmentActivity; 
import android.support.v4.app.FragmentManager; 
import android.support.v4.app.FragmentTransaction; 
 
import com.xufan.wirelessOrder.fragment.ServerFragment; 
 
public class ServerActivity extends FragmentActivity{ 
	public static FragmentManager fm;
	 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_stack); 
        fm = getSupportFragmentManager();
         
        // 只當容器,主要內容已Fragment呈現 
        initFragment(new ServerFragment()); 
    } 
    // 切換Fragment 
    public static void changeFragment(Fragment f){
        changeFragment(f, false);
Contextual code suggestions in your IDE  Get Codota for Java