The navigation component consists of 3 keywords that are described as below



Download 0,65 Mb.
Sana26.02.2022
Hajmi0,65 Mb.
#465403
Bog'liq
Navigation Component


The navigation component consists of 3 keywords that are described as below:
1 – Navigation Graph: is a resource file that contains all your destinations and actions. The graph represents all of your app’s navigation paths.
2 – NavHost: is an empty container that displays destinations from your navigation graph. The navigation component contains a default NavHost implementation, NavHostFragment, that displays fragment destinations.
3 – NavController: its an object that manages app navigation within a NavHost. This would help to replace one fragment with another fragment in the NavHost container.


PopTo Not-Inclusive
Pops off everything on the back stack until it finds the referenced fragment transaction.
PopTo Inclusive
Pops off everything on the back stack, including the referenced fragment transaction.

Adding an Overflow Menu
Step 1: Create the new menu resource.
Right click on the res folder within the Android project and select New -> Android Resource File. Name it overflow_menu with resource type menu. Add an About menu item with the ID of the aboutFragment.
Step 2: Call setHasOptionsMenu(true)
This tells Android that our fragment has an options menu, so it will call onCreateOptionsMenu.
Step 3: Override onOptionsItemSelected
Return true if NavigationUI.onNavDestinationSelected returns true, else return super.onOptionsItemSelected.


ATTRIBUTE

FUNCTION

onOptionsItemSelected

Called when a menu item is selected

setHasOptionsMenu

Tells Android that the Fragment has a menu

onCreateOptionsMenu

Where you inflate your menu

title

String displayed in the menu

id

Used by navigation to determine where to navigate


Passing arguments from the Fragment-A to the Fragment-B
Fragments contain arguments in the form of an Android bundle, which is the key value store. A key value store, also known as a dictionary or associative array, is a data structure we use a unique key such as a string to fetch an associated value.

There are limited types that can be stored as value in a bundle. Primitive types such as char, int and float, along with various types of arrays, char sequence, and a few data classes such as arrayList.

Safe Args is a Gradle plugin that generates code to help guarantee that the arguments on both sides match up, while also simplifying argument passing. Because it’s a Gradle plugin, using it is a two-step process in terms of what to add to your Gradle files.
Download 0,65 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish