super.onStart(); Util.checkUserStatus(result -> { // what if this callback is invoked AFTER activity is stopped? if (result) { myLocationListener.start(); } }); } // onStop() } @nisrulz #devfest17
super.onStart(); Util.checkUserStatus(result -> { // what if this callback is invoked AFTER activity is stopped? if (result) { myLocationListener.start(); } }); } // onStop() } @nisrulz #devfest17
void start() { // connect to system location service } @OnLifecycleEvent(Lifecycle.Event.ON_STOP) public void stop() { // disconnect from system location service } } @nisrulz #devfest17
void start() { // connect to system location service } @OnLifecycleEvent(Lifecycle.Event.ON_STOP) public void stop() { // disconnect from system location service } } @nisrulz #devfest17
simple class to store and manage ui-related data Data survives configuration changes such as screen rotation No memory leaks (no references to activity or fragment or views)
data across configuration changes - they are not persisted if the application is killed by the operating system. SavedInstanceState - stores data, usually ID - they are saved in system process memory, OS limits the amount
uid; @ColumnInfo(name = "first_name") private String firstName; @ColumnInfo(name = "last_name") private String lastName; // Getters and setters are ignored for brevity, // but they're required for Room to work. }
uid; @ColumnInfo(name = "first_name") private String firstName; @ColumnInfo(name = "last_name") private String lastName; // Getters and setters are ignored for brevity, // but they're required for Room to work. }