标签:ase put hashmap port highlight return ash roi switch
import android.support.v4.app.Fragment; import java.util.HashMap; public class FragmentFactory { private static HashMap<Integer, Fragment> savedFragment = new HashMap<Integer, Fragment>(); public static Fragment getFragment(int position) { Fragment fragment = savedFragment.get(position); if (fragment == null) { switch (position) { case 0: fragment = new Fragment01(); break; case 1: fragment = new Fragment02(); break; case 2: fragment = new Fragment03(); break; case 3: fragment = new Fragment04(); break; } savedFragment.put(position, fragment); } return fragment; } }
标签:ase put hashmap port highlight return ash roi switch
原文地址:http://www.cnblogs.com/loaderman/p/6566501.html