June 5, 2019
androidx.activity:activity-ktx:1.0.0-beta01 are released with no changes from
1.0.0-alpha08. The commits included in this version can be found here.
May 7, 2019
androidx.activity:activity-ktx:1.0.0-alpha08 are released. The commits included in this version can be found here.
- Breaking change: The previously deprecated
ComponentActivityhave been removed. aosp/953857
OnBackPressedCallbackare now final. b/131416833
OnBackPressedCallbackis now final. aosp/952720
OnBackPressedDispatchernow has public constructors, allowing you to construct your own instances for testing, etc. aosp/953431
ComponentActivityis now explicitly marked as
- Fixed a
remove()from within the
handleOnBackPressed()method of a
OnBackPressedCalbackthat was added with a
April 25th, 2019
androidx.activity:activity-ktx:1.0.0-alpha07 are released. The commits included in this version can be found here.
This release makes significant changes to the handling of the
onBackPressed(). See the updated custom back documentation for more details.
- The methods for
OnBackPressedDispatcherhave been marked as
handleOnBackPressed()method no longer returns a
OnBackPressedCallbackis now an abstract class that can be enabled or disabled - only when the new
isEnabled()method returns true will
handleOnBackPressed()be called, in which you must handle the back button. (aosp/944518)
OnBackPressedDispatcherno longer return a
OnBackPressedCallbacknow contain a
remove()method that fulfill this functionality, allowing you to call
handleOnBackPressed(). (aosp/944519) (aosp/946316)
activity-ktxnow contains a receiver scoped callback for
addCallbackthat accepts a lamdba that implements
handleOnBackPressed()and has access to
April 3rd, 2019
androidx.activity:activity-ktx:1.0.0-alpha06 are released. The commits included in this version can be found here.
- ComponentActivity now contain a second constructor that takes a
@LayoutRes int, which replaces the previous behavior of annotating your AppCompatActivity class with
@ContentView. This approach works in both app and library modules. (b/128352521)
OnBackPressedCallbackrelated APIs on ComponentActivity have been deprecated in favor of the new
OnBackPressedDispatcher, retrievable via
- Methods to add a new
OnBackPressedDispatchernow return a
Cancellableobject, allowing removal of the callback without requiring an explicit reference to the
- Adding a
OnBackPressedCallbackwith an associated
LifecycleOwnernow results in adding and removing the
OnBackPressedCallbackas the Lifecycle is started and stopped, respectively. (aosp/922523)
March 13th, 2019
androidx.activity:activity-ktx:1.0.0-alpha05 are released. The full list of commits
included in this release can be found here.
@ContentViewannotation lookups are now cached (b/123709449)
January 30, 2019
androidx.activity:activity-ktx 1.0.0-alpha04 are released.
- Added support for the
@ContentViewclass annotation that allows you to indicate which layout XML file should be inflated as an alternative to using
- Added a note that
getViewModelStore()should not be overridden and will be made final in a future release. Please file a feature request if you are currently overriding this method. (aosp/837619)
activitymodule now depends on version 2.1.0-alpha02 of ViewModel to match the
December 17, 2018
androidx.activity 1.0.0-alpha03 is released.
- ComponentActivity now implements
BundleSavedStateRegistryOwnerand depends on the newly released SavedState library [aosp/815133]
- ComponentActivity now works around an Android framework bug that would cause InputMethodManager to leak the last focused view [b/37122102]
December 3, 2018
- Added a note that
getLifecycle()should not be overridden and will be made
finalin a future release. Please file a feature request if you are currently overriding this method. (aosp/815834)
November 5, 2018
androidx.activity 1.0.0-alpha01 introduces
ComponentActivity, a new base class of the existing
- You can now register an
onBackPressed()callbacks without needing to override the method in your activity.
- Added a new
by viewModels()Kotlin property delegate for retrieving
ViewModels from a
- Pending input events (such as clicks) are now canceled in
- The implementation of
ViewModelStoreOwnerhave been moved from
onRetainCustomNonConfigurationInstancehas been deprecated. Use a
ViewModelfor storing objects that need to survive configuration changes.