Activity

Version 1.0.0-alpha04

January 30, 2019

androidx.activity:activity 1.0.0-alpha04and androidx.activity:activity-ktx 1.0.0-alpha04 are released.

New features

  • Added support for the @ContentView class annotation that allows you to indicate which layout XML file should be inflated as an alternative to using setContentView(). (aosp/837619)

API changes

  • 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)

Bug fixes

  • The activity module now depends on version 2.1.0-alpha02 of ViewModel to match the activity-ktx module’s dependency.

Version 1.0.0-alpha03

December 17, 2018

androidx.activity 1.0.0-alpha03 is released.

New features

  • ComponentActivity now implements BundleSavedStateRegistryOwner and 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]

Version 1.0.0-alpha02

December 3, 2018

API changes

  • Added a note that getLifecycle() 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/815834)

Version 1.0.0-alpha01

November 5, 2018

androidx.activity 1.0.0-alpha01 introduces ComponentActivity, a new base class of the existing FragmentActivity and AppCompatActivity.

New features

  • You can now register an OnBackPressedCallback via addOnBackPressedCallback to receive onBackPressed() callbacks without needing to override the method in your activity.
  • Added a new by viewModels() Kotlin property delegate for retrieving ViewModels from a ComponentActivity.
  • Pending input events (such as clicks) are now canceled in onStop().

API changes

  • The implementation of LifecycleOwner and ViewModelStoreOwner have been moved from FragmentActivity to ComponentActivity.
  • onRetainCustomNonConfigurationInstance has been deprecated. Use a ViewModel for storing objects that need to survive configuration changes.