This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void useCaseExample() { | |
storageAbstraction.loadSomeData(); | |
filterData(); | |
doSomeComputation(); | |
uiAbstraction.presentDataToUser(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String makeFragmentName(int viewId, int index) { | |
return "android:switcher:" + viewId + ":" + index; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return the Fragment associated with a specified position. | |
*/ | |
public abstract Fragment getItem(int position); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public Object instantiateItem(View container, int position) { | |
if (mCurTransaction == null) { | |
mCurTransaction = mFragmentManager.beginTransaction(); | |
} | |
// Do we already have this fragment? | |
String name = makeFragmentName(container.getId(), position); | |
Fragment fragment = mFragmentManager.findFragmentByTag(name); | |
if (fragment != null) { |
NewerOlder