{ compositeDisposable.dispose(); } } public class UsersFragment { @Override public void onDestroy() { presenter.onDestroy(); } } Traditional Presenterীࢲ dispose()ܳ Fragment onDestroyী ݏ୶য ࣻ೯೧ঠ ೠ
this.lifecycle = lifecycle; } public void enable() { if (lifecycle.getCurrentState().isAtLeast(Lifecycle.State.STARTED)) { // connect if not connected } } } Jetpack
this.lifecycle = lifecycle; } public void enable() { if (lifecycle.getCurrentState().isAtLeast(Lifecycle.State.STARTED)) { // connect if not connected } } } Jetpack Lifecycle Wrapping Class
listUsers(); @Query("SELECT * FROM user WHERE id = :userId") User getUser(long userId); @Insert long insert(User user); @Update void update(User user); @Delete void delete(User user); } Jetpack
listUsers(); @Query("SELECT * FROM user WHERE id = :userId") User getUser(long userId); @Insert long insert(User user); @Update void update(User user); @Delete void delete(User user); } Jetpack Annotationਵ۽ Query
listUsers(); @Query("SELECT * FROM user WHERE id = :userId") User getUser(long userId); @Insert long insert(User user); @Update void update(User user); @Delete void delete(User user); } Jetpack Rx, LiveData ਗ