Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Breaking Down the AndroidX Navigation Framework

Breaking Down the AndroidX Navigation Framework

Is the new Navigation Architecture Component worth investing your precisous time in? In this talk we’ll attempt to answer that by exploring its feature set and live coding examples.

In this talk we’ll cover the new Navigation Architecture Component that was announced at Google I/O 2018. We’ll explain why this is a very important change to how we should consider building Android applications going forward and go through the features of the component via live coding examples.

Jerrell Mardis

February 01, 2019
Tweet

More Decks by Jerrell Mardis

Other Decks in Technology

Transcript

  1. {com.jerrellmardis.fragmentsareterrible/com.jerrellmardis.fragmentsareterrible.MainActivity}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at

    android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4151) at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4121) at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4196) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:192) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at androidx.fragment.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:2080) at androidx.fragment.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:2106) at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:683) at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:637) at com.jerrellmardis.fragmentsareterrible.MainActivity.onStop(MainActivity.kt:25) at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1432) at android.app.Activity.performStop(Activity.java:7367) at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4143) at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4121) at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4196) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:192) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method)
  2. …More Pain Points Fragment Transactions are error prone Animating Fragments

    are difficult Managing the back-stack seems like a failure of the framework Managing Deep Links is not scalable Passing Arguments is not type-safe
  3. More Pain Points… Fragment Transactions are error prone Animating Fragments

    are difficult Managing the back-stack seems like a failure of the framework Managing Deep Links is not scalable Passing Arguments is not type-safe
  4. Navigation Provides Declarative approach Manages back-stack and up/back button behavior

    Reduces boilerplate code Simplifies creating Fragment animations Removes the need to write Fragment transactions Creates a type-safe way to pass Fragment arguments
  5. Navigation Provides Declarative approach Manages back-stack and up/back button behavior

    Reduces boilerplate code Simplifies creating Fragment animations Removes the need to write Fragment transactions Creates a type-safe way to pass Fragment arguments
  6. Navigation Provides Declarative approach Manages back-stack and up/back button behavior

    Reduces boilerplate code Simplifies creating Fragment animations Removes the need to write Fragment transactions Creates a type-safe way to pass Fragment arguments
  7. Navigation Provides Declarative approach Manages back-stack and up/back button behavior

    Reduces boilerplate code Simplifies creating Fragment animations Removes the need to write Fragment transactions Creates a type-safe way to pass Fragment arguments
  8. Navigation Provides Declarative approach Manages back-stack and up/back button behavior

    Reduces boilerplate code Simplifies creating Fragment animations Removes the need to write Fragment transactions Creates a type-safe way to pass Fragment arguments
  9. Navigation Provides Declarative approach Manages back-stack and up/back button behavior

    Reduces boilerplate code Simplifies creating Fragment animations Removes the need to write Fragment transactions Creates a type-safe way to pass Fragment arguments
  10. Navigation Provides Declarative approach Manages back-stack and up/back button behavior

    Reduces boilerplate code Simplifies creating Fragment animations Removes the need to write Fragment transactions Creates a type-safe way to pass Fragment arguments
  11. Breaking Down the AndroidX Navigation Framework Jerrell Mardis @jerrellmardis Making

    Fragments Great Again Finally speakerdeck.com/jerrellmardis