Wpis z mikrobloga

#android #programowanie #java

Mam Activity które dziedziczy po AppCompatActivity (z tego co widzę jest tu zaimplementowany ActionBar). Jednocześnie w ramach tej klasy chcę także używać obiektów LiveData, co zmusza mnie do dziedziczenia po LifecycleActivity. Java z tego co wiem nie pozwala na dziedziczenie z dwóch klas jednocześnie, co więc zazwyczaj robi się w takich sytuacjach?
  • 3
  • Odpowiedz
@piotrek-5: Note: Since the Architecture Components are in alpha stage, Fragment and AppCompatActivity classes cannot implement it (because we cannot add a dependency from a stable component to an unstable API). Until Lifecycle is stable, LifecycleActivity and LifecycleFragment classes are provided for convenience. After the Lifecycles project is released, support library fragments and activities will implement the LifecycleOwner interface; LifecycleActivity and LifecycleFragment will be deprecated at that time. Also, see
  • Odpowiedz