Created
September 22, 2015 18:27
-
-
Save orhanobut/6dc198f834bdf428bf1c to your computer and use it in GitHub Desktop.
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 class BaseFragment extends Fragment { | |
private static final String KEY_UUUID = "KEY_UUID"; | |
private String uuid; | |
@Override public void onCreate(Bundle bundle) { | |
super.onCreate(bundle); | |
if (bundle != null && bundle.containsKey(KEY_UUID)) { | |
uuid = bundle.getString(KEY_UUID); | |
} else { | |
uuid = UUID.randomUUID().toString(); | |
} | |
} | |
@Override public void onSaveInstanceState(Bundle outState) { | |
outState.putString(KEY_UUID, uuid); | |
super.onSaveInstanceState(outState); | |
} | |
protected boolean isEqual(String uuid) { | |
return TextUtils.equals(uuid, this.uuid); | |
} | |
public String getUUID(){ | |
return uuid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment