Android JET Navigation
Who I am - @mbonifazi
● Android developer since Eclair
● GDE...what else? A high carb
addicted
● I hate MS Office & Jira notifications
My best quote: Day by day is the best way
https://androiddevs.it/
Headlines
➔ How we were & are
● How we wanna be
● How we apply best practices
Android JET Navigation
Google+: https://plus.google.com/+DianneHackborn/posts/FXCCYxepsDU
Activity
added in API level 1
val intent = Intent(this, DisplayMessageActivity::class.java).apply {
putExtra(EXTRA_MESSAGE, message)
}
startActivity(intent)
<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_view_http_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
</intent-filter>
Fragment
added in API level 11
Deprecated since API level 28
companion object {
@JvmStatic
fun newInstance(param1: String, param2: String) =
BlankFragment().apply {
arguments = Bundle().apply {
putString(ARG_PARAM1, param1)
putString(ARG_PARAM2, param2)
}
}
}
val detailsFragment = DetailsFragment.newInstance(comic)
supportFragmentManager.beginTransaction()
.replace(R.id.root_layout, detailsFragment, "rageComicDetails")
.addToBackStack(null)
.commit()
Headlines
● How we were & are
➔ How we wanna be
● How we apply Best practices
Android Jetpack
Android JET Navigation
Android JET Navigation
Principles of Navigation
Android JET Navigation
Android JET Navigation
Back button Up button
Android JET Navigation
def nav_version = "1.0.0-alpha05"
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
Android JET Navigation
Android JET Navigation
Android JET Navigation
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:startDestination="@+id/home_dest">
<!-- ...tags for fragments and activities here -->
</navigation>
Destinations
<fragment
android:id="@+id/flow_step_one_dest"
android:name=".navigation.FlowStepFragment"
tools:layout="@layout/flow_step_one_fragment">
</fragment>
Android JET Navigation
<LinearLayout>
<androidx.appcompat.widget.Toolbar/>
<fragment
………...
android:id="@+id/my_nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
app:navGraph="@navigation/mobile_navigation"
app:defaultNavHost="true"
/>
<com.google.android.material.bottomnavigation.BottomNavigationView/>
</LinearLayout>
Action
Android JET Navigation
<fragment
android:id="@+id/flow_step_one_dest"
android:name=".navigation.FlowStepFragment">
<action
android:id="@+id/next_action"
app:destination="@+id/flow_step_two_dest">
</action>
</fragment>
NavController
findNavController().navigate(R.id.flow_step_one_dest)
findNavController().navigate(R.id.nextAction)
val options = navOptions {
anim {
enter = R.anim.slide_in_right
exit = R.anim.slide_out_left
popEnter = R.anim.slide_in_left
popExit = R.anim.slide_out_right
}
}
view.findViewById<Button>(R.id.navigate_destination_button)?.setOnClickListener {
findNavController().navigate(R.id.flow_step_one_dest, null, options)
}
apply plugin: 'androidx.navigation.safeargs'
<fragment
android:id="@+id/flow_step_one_dest"
android:name="com.example.android.codelabs.navigation.FlowStepFragment"
tools:layout="@layout/flow_step_one_fragment">
<argument
android:name="flowStepNumber"
app:argType="integer"
android:defaultValue="1"/>
...
</fragment>
val flowStepNumber = arguments?.getInt("flowStepNumber")
val safeArgs = FlowStepFragmentArgs.fromBundle(arguments)
val flowStepNumber = safeArgs.flowStepNumber
Deep linking
<fragment
android:id="@+id/flow_step_one_dest"
android:name="com.example.android.codelabs.navigation.FlowStepFragment"
tools:layout="@layout/flow_step_one_fragment">
…..
<deepLink app:uri="www.example.com/{myarg}" />
</fragment>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<nav-graph android:value="@navigation/mobile_navigation" />
</activity>
Headlines
● How we were & are
● How we wanna be
➔ How we apply best practices
Android JET Navigation
References
● https://github.com/googlesamples/android-sunflower
● https://www.youtube.com/watch?v=2k8x8V77CrU
● https://www.youtube.com/watch?v=7p22cSzniBM
● https://developer.android.com/topic/libraries/architecture/navigation/
● https://bit.ly/2PNQbb7
Codelab: https://codelabs.developers.google.com/codelabs/android-navigation
matteobonifazi@gmail.com - @mbonifazi

More Related Content

PPTX
AngularJs advanced Topics
PPTX
Angular js slides
PPTX
Java script framework-roller-coaster
PPTX
Android - Intents and Filters hgfh gfh.pptx
PPTX
Android Workshop
PPTX
Intents in Mobile Application Development.pptx
PDF
Tut123456.pdf
PPTX
Android Intent.pptx
AngularJs advanced Topics
Angular js slides
Java script framework-roller-coaster
Android - Intents and Filters hgfh gfh.pptx
Android Workshop
Intents in Mobile Application Development.pptx
Tut123456.pdf
Android Intent.pptx

Similar to Android JET Navigation (15)

PPTX
05 intent
PPTX
unit3.pptx
PPTX
Data Transfer between activities and Database
PDF
Android Basic Components
PPTX
Pertemuan 03 - Activities and intents.pptx
PDF
Intents in Android
DOCX
Using intents in android
PDF
Going Deep w Navigation
PPTX
Android session 2-behestee
PPTX
Android - Intents - Mazenet Solution
ODP
Android App Development - 02 Activity and intent
PPT
Android Bootcamp Tanzania:intents
PDF
android_mod_3.useful for bca students for their last sem
PDF
Intents are Awesome
PPTX
Unit-1.2 Android-Activities, Fragments, and Intents (1).pptx
05 intent
unit3.pptx
Data Transfer between activities and Database
Android Basic Components
Pertemuan 03 - Activities and intents.pptx
Intents in Android
Using intents in android
Going Deep w Navigation
Android session 2-behestee
Android - Intents - Mazenet Solution
Android App Development - 02 Activity and intent
Android Bootcamp Tanzania:intents
android_mod_3.useful for bca students for their last sem
Intents are Awesome
Unit-1.2 Android-Activities, Fragments, and Intents (1).pptx
Ad

More from Matteo Bonifazi (17)

PDF
Invading the home screen
PDF
Engage user with actions
PDF
Kotlin killed Java stars
PDF
Firebase-ized your mobile app
PDF
Backendless apps
PDF
Android - Saving data
PDF
Android Networking
PDF
Android - Displaying images
PDF
Android - Background operation
PDF
Android things intro
PDF
The Firebase tier for your mobile app - DevFest CH
PDF
Engage and retain users in the android world - Droidcon Italy 2016
PDF
UaMobitech - App Links and App Indexing API
PDF
The unconventional devices for the Android video streaming
PDF
Google IO - Five months later
PDF
Video Streaming: from the native Android player to uncoventional devices
PDF
Enlarge your screen
Invading the home screen
Engage user with actions
Kotlin killed Java stars
Firebase-ized your mobile app
Backendless apps
Android - Saving data
Android Networking
Android - Displaying images
Android - Background operation
Android things intro
The Firebase tier for your mobile app - DevFest CH
Engage and retain users in the android world - Droidcon Italy 2016
UaMobitech - App Links and App Indexing API
The unconventional devices for the Android video streaming
Google IO - Five months later
Video Streaming: from the native Android player to uncoventional devices
Enlarge your screen
Ad

Recently uploaded (20)

PPTX
AI-Reporting for Emerging Technologies(BS Computer Engineering)
PDF
Lesson 3 .pdf
PPTX
chapter 1.pptx dotnet technology introduction
PPTX
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
PPTX
Solar energy pdf of gitam songa hemant k
PDF
LS-6-Digital-Literacy (1) K12 CURRICULUM .pdf
PPTX
Software-Development-Life-Cycle-SDLC.pptx
PDF
ASPEN PLUS USER GUIDE - PROCESS SIMULATIONS
PDF
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
PDF
CELDAS DE COMBUSTIBLE TIPO MEMBRANA DE INTERCAMBIO PROTÓNICO.pdf
PDF
Principles of operation, construction, theory, advantages and disadvantages, ...
PDF
Performance, energy consumption and costs: a comparative analysis of automati...
PPTX
Module1.pptxrjkeieuekwkwoowkemehehehrjrjrj
DOCX
An investigation of the use of recycled crumb rubber as a partial replacement...
PPTX
Real Estate Management PART 1.pptxFFFFFFFFFFFFF
PPTX
SE unit 1.pptx by d.y.p.akurdi aaaaaaaaaaaa
PPTX
Wireless sensor networks (WSN) SRM unit 2
PPTX
Unit IImachinemachinetoolopeartions.pptx
PDF
Project_Mgmt_Institute_-Marc Marc Marc .pdf
PDF
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering
AI-Reporting for Emerging Technologies(BS Computer Engineering)
Lesson 3 .pdf
chapter 1.pptx dotnet technology introduction
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
Solar energy pdf of gitam songa hemant k
LS-6-Digital-Literacy (1) K12 CURRICULUM .pdf
Software-Development-Life-Cycle-SDLC.pptx
ASPEN PLUS USER GUIDE - PROCESS SIMULATIONS
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
CELDAS DE COMBUSTIBLE TIPO MEMBRANA DE INTERCAMBIO PROTÓNICO.pdf
Principles of operation, construction, theory, advantages and disadvantages, ...
Performance, energy consumption and costs: a comparative analysis of automati...
Module1.pptxrjkeieuekwkwoowkemehehehrjrjrj
An investigation of the use of recycled crumb rubber as a partial replacement...
Real Estate Management PART 1.pptxFFFFFFFFFFFFF
SE unit 1.pptx by d.y.p.akurdi aaaaaaaaaaaa
Wireless sensor networks (WSN) SRM unit 2
Unit IImachinemachinetoolopeartions.pptx
Project_Mgmt_Institute_-Marc Marc Marc .pdf
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering

Android JET Navigation