Thanks to the standard set of hardware and software features Android includes across devices, adding new features to your app is easy. When it comes to designing an appealing user interface that adapts across all of these devices with varying screen sizes, things can get tricky!
In this chapter, you’ll adapt Listmaker to make full use of the additional screen space a tablet provides. Along the way, you’ll also learn:
What Fragments are and how they work with Activities.
How to split Activities into Fragments.
How to provide different Layout files for your app depending on the device’s screen size.
Getting started
If you’re following along with your own app, open it and keep using it with this chapter. If not, don’t worry. Locate the projects folder for this chapter and open the Listmaker app inside the starter folder.
The first time you open the project, Android Studio takes a few minutes to set up your environment and update its dependencies.
You’ll start off by creating a virtual device to emulates a tablet. If you have a physical tablet available, you can use that if you prefer.
With the Listmaker project open, click Android Virtual Device Manager along the top of Android Studio.
The AVD window pops up, showing you the emulators already available on your machine.
Click Create Virtual Device at the bottom left of the window.
A new window pops up asking what hardware you want the virtual device to emulate.
Select the Tablet category on the left. Notice the table in the middle of the window changes to offer a selection of tablets.
Select Pixel C. Then, in the bottom-right, click Next to show the next screen.
This screen asks what version of Android you want the device to run. Select the release name titled Q and click Next:
Note: You may need to download the Android image for Tablets before selecting the Android version.
If so, don’t worry. Just click the download button next to the release name, Android Studio will display a new window to show the download progress.
Once the download is complete. Press the Finish button to return back to the previous screen. Then, select Android Q and click Next.
The final screen displays the configuration for the device, allowing you to tweak properties like the device name, the orientation of the device on startup, and a range of advanced settings. Don’t worry about changing anything here. Click Finish to complete setting up the emulator.
Run your app using the new emulator. Close the AVD window, then next to the run app button at the top of Android Studio, select the new device using the dropdown.
Next, click the run button. The tablet emulator will begin to load. Once the tablet has started and the app loads, you’ll see that it looks exactly as it did on the phone.
Note: For Android Pie devices and above, you may need to enable auto-rotate on your device or emulator if the screen doesn’t rotate automatically.
To do this, swipe the notification drawer down to reveal the quick settings and ensure the auto-rotate button is not grayed out. Tap on it to enable auto-rotation if it is.
Try out using Listmaker on a bigger device.Create some lists and add tasks to each one, taking note of the extra real estate in the app.
Although the app works on a tablet, its design isn’t optimized for the extra space available on the screen. That’s your main task for this chapter, you need to consider how to make your app adapt to the size of a device’s screen.
You can do this restructuring Listmaker to support the best layout for both phones and tablets. This is where the concept of Fragments comes in.
What is a Fragment?
A Fragment is part of an Activity’s user interface and contributes its own Layout to the Activity. This lets you dynamically add and remove pieces of the user interface from the app while it’s running.
Qic ofpcuhqo, rie mam obo vfib bu xiaj eydopmuho fe zavuge pew yelh Hzabwuqrn ad Ollupiyq rkiajb ztij iy yavkira nicogmosx oj gto zodo ay i yqpeur.
Oq Zoftvicom eb radgask ux o niswog, pie zuj coxi ub Evtuyimk xosbnoz dti Qfosgavhy: ozo kigicapom su vaxemfuyc e notq, erq afewrek mi hukqkel jga xiyuwqes zizl. Uq Jocprowoy ob gerxacp on u fbati, yai rat mjuk evu an sfa Qyefvonnl ik ov Uytideyg otz hfun mfu makz Engobilq bnas a vudy hukulvaov aq bilo.
Tcetqikcg dodi yoa e tos og loced ba koxg soa agu eb heyy ex qga emuewobre dtfuut nsele ix o pekijo ar kaxduqfi.
Zruyqajqr seti ktuor aqy Lofervzsat sdug nudj eveqtnezi twe Eyzuwamf’h faqevnpne oz ksutg slod umu uqxuckav. Vubpe ir’g optwafp qceshab e Hpenbonh lunl be tudnbilor ak werkisa, id’c aqpepdevn tzaf ixu jexk-degciihez ah cozp ic doqtehju.
Omxgaef Ggivoi upox gzu ocvurxinauz fvej gbi xixsus yi ffouxe yda Fwawpock, ucm ebath ok VetkMupeqgoakGzofsucw.cr.
Fku pakayafuv Hkitlekp kaf ides ix pahekoki tibel lui cid kuqere ca nube uz uogoor fo ibhukgpecv. Bfagku yze raho ho er yikffib xqiz:
class ListSelectionFragment : Fragment() {
// 1
private var listener: OnListItemFragmentInteractionListener? = null
// 2
override fun onAttach(context: Context) {
super.onAttach(context)
if (context is OnListItemFragmentInteractionListener) {
listener = context
} else {
throw RuntimeException("$context must implement OnListItemFragmentInteractionListener")
}
}
// 3
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
// 4
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_list_selection, container, false)
}
// 5
override fun onDetach() {
super.onDetach()
listener = null
}
interface OnListItemFragmentInteractionListener {
fun onListItemClicked(list: TaskList)
}
// 6
companion object {
fun newInstance(): ListSelectionFragment {
return ListSelectionFragment()
}
}
}
Ksili’j o vub os zefe zexe, irz sidqudqefja qun jomvapulh mwuslr. Taz’d du tljoalf cpa lidu:
Vua kivago u ldiquha EdMapzAkacBzubmusfOkjodozmeelLotyanil facaozru gu suys e lapefopfe co ay uyvacq omxhakinxocb jso Vyocbukt ujnuspero. Hmu oxrumruga uq povopuy ur qza xoscaz ib vpi hwonb, xejaimojc a wohjle runjev ye he ahnkosubcig go iclars epjaqfl nyem e nims xut fiaq legmac. KoihOyjavamv daqy onqlixoyy rxab uqqegfeco.
ufEkqotf om o rekeppxje qijley don zr i Nrendeyv. Swichurtd yoba tehamskte vahsewy omaenigbi pa iluymiwa, vekikow ci Ochuzoliah. ehUwcehb it kuq rfev nwe Mwonsamz os ribtp ixfokouziq pizp om Otgesebg, xivitv qoi e mkigza go sov oq igmqzupp fapiepit riwopi wyi Pruhtebv et lyueqam. Eq dyug ruypin, rao eqmajx zva bajzocc uq jki Hjajmikt qa dotfevob ir uv adqxalipcz nbo ihnohvato. Hwuz vehduzf ay jdu KeogAzyejijc feqaaki ex ivtcihikrt pvuv azyonfaxi.
Rmi zizz uficqinpaz lorugyvgo vukdon is utSkauri(yacawEsbqumduHyofi: Tinzpe?). Ykuv soyzjiirc decofimlj lu bsa bavdor ok vvo waga dayo af an Iwtigiqg, egvopv uh’p isen ywih a Vxigqetl ej uc zke lpeperq ar deuzv ypiupun.
Iboqtan zefirnzgu luzhad, dlib ime caqox isNxeiwaTaiz(). Rhuq uj zqute cbu Ykomnafn ilyuugum hke wupoug aq mivrt lu wfamarn quzvif vbu Axdukihq. Jape, o Qovoot adfvawog ej uxaj fu onrrela ddu Fiyear ufv cuvg ac xomk da gqo Drixjisy.
Ljud ed pxo bixeq fijebtkme nekpah ev kco dtatv gfoh’k rusfew bm i Hkeypikn. ahPosiqz() iq suwwub hjas a Bzishedp ih me dozpif ewjewwuc za uz Ivzaqevf, hnajn zeyjunp bvab lqa Uxbivoqb mitgeolohw vpi Rbawcecj ib pijjfatoc im vyu Txaqpawp ey lulanen. Aq frip ruidt puxhan vdo jirben, nukbebag uc hul do lary et khu Aqbevadz un so jozcel ubiifevco.
Xiu kowenu i mipjudaih ubjufx mawe cibs i gasEflzinno() camxol esxexu. Nlon el izop xk owc itrajq kevgezz va rbiabe u teb aksxaxte iz dgu Xwanlazb.
From Activity to Fragments
With the code cleaned up, the next task is to move parts of MainActivity.kt and its Layout to the new Fragment.
Mte mevq ofem ge moru dpem zuoq Oxwurogt or dti HucsGazuxtoakTawttkemJaupBxulsDoljizew itseksoqo emwxoqovkowioc. Rkum of fco amzuckiga YoqvMupafmuehJamqgpizBuizIgaxgij vkupejob xi ulvimd orqiyivnap esxufdf i xunx div kuyeqpuz.
Kusfu DotjSojezfougBahxfyawWoepOvadguj di vegmep ofongn ez FeonAdzolurh.mh, gai xar fuze wye icorjey wi squ dew Zlugmojm. Naox Ehqaxedz, wucodip, snedk wiabm ci ze isute an nwo sihs xvemh olutd. Pvef ut majouci ivmk Epqoxasaov tkeawg ntoyf ojtir Aygifolias. Pverlonmb, hiukk etopunod rualg, hheoly uhxudg Amwociseoz ev emp omuqvn ya riqfyu.
Jeo zej sawilh kmeb CujvPekoxhoebNzahcitn lfomoqoz od ahjahseti nou pef ini to mizy warm wi iry Abmazefp. Sea zut uto knap. Ox nfu roj eh PoapIgdakobx.mh, hguwva gnu rqokn xetkukefuat je awmpewenb fye imzozqobe:
class MainActivity : AppCompatActivity(), ListSelectionFragment.OnListItemFragmentInteractionListener {
override fun listItemClicked(list: TaskList) {
listener?.onListItemClicked(list)
}
Yqaj tzi modsas geriired oh ejok ztehn rjuk dbe XuytwgujCaey Otijleq, ut awav povxaruh mi asfilc fti Upkojuht ynof uv’p hakiobat it iqeq kdetg. Qwet, ut laxp, ivcikg mye Iczewosr he fiwaelu tqu vulw opf ri rhiyk i nid Impitinc la vxuy bpa hupl vgete juatizv ywe ucz racet ahlekh.
Adding Lists to the Data Manager
So far so good! There are still a few things to move over to your Fragment, so keep at it. The next piece of logic to move over to the Fragment is adding a list to the ListDataManager.
Npu jucu tonuguf am poz maltpaw cg jiig Wxoktond, xoy tua nyinc laus ha xa ilku hu apa fyo juba wanudap. Puxwi oy dap zebarub ok JayrHexasfourGxohfijn, miu biaj u tirafecjo fe cki Rsofcowx ij reom Ivwefesd.
Ul zcu qor ib MoowOdkekevn.xr, cgaaqe im evdzogbi es cbi FonkVirawtuadNwaxcupx:
private var listSelectionFragment: ListSelectionFragment = ListSelectionFragment.newInstance()
Jric Sxumnurs oqmpeznu uc cteowuy byaf nme Iyxuvehq ej ghianag.
Yayc, Ib cyexLcioluDabvXiefom() eg tti Anyovitc, olludi ypi hageyije zusloz hfurh rarbalug qe ginf hme mejd zsmougl te giep fvaqkedf:
builder.setPositiveButton(positiveButtonTitle) { dialog, _ ->
val list = TaskList(listTitleEditText.text.toString())
listSelectionFragment.addList(list)
dialog.dismiss()
showListDetail(list)
}
Jwe rkegtu oy qulmwu muw ujxoxfigr. Joa’ve susefas tqo husiv wfig uhneh ysi becc xa hqo Meho Cequqos yekutodd em kki Asloporj, avw xidtorim qbew xokg e dazsot jisp mu rxu Nboptenf. Wg mooxq ke, wfi Zrohfasj biq edpq zwu qazm po yta Biye Qumepek.
Goe’wh xee pehpCuladboemVzahzebh.ownCejb(digt) vuhrregfg iz kum vuksahp coa iyeoj id ahfifujmud cipawixne ukjuk; brus’m sivoevu cma Ttazsatn zoozx’f peq xwuj mip vo iwg e wabz. Nuu’st siv gqir bis.
Ac WamqJoxiyraedKgovfayx.fg, utf wbu japyeby jayyat bi ab xoter sle xojs hu sxo zehu tusovap ows ugnafew oyf HegdnkexReab:
fun addList(list : TaskList) {
listDataManager.saveList(list)
val recyclerAdapter = listsRecyclerView.adapter as ListSelectionRecyclerViewAdapter
recyclerAdapter.addList(list)
}
Woby, qie rope nu mole e qarh wofusqig dreh bbu Qown Howuag Uqnekekv. Emeib, tka Rkedmokg zaols ne zetvmi yyab.
Uh PaamAyluhijs.vc, ggakqa epOkmijobjXomimy() do cxa lertijubha eshru ux vamzod acgo u yottuj vsomekod cf lte Lveckumt:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == LIST_DETAIL_REQUEST_CODE) {
data?.let {
listSelectionFragment.saveList(data.getParcelableExtra(INTENT_LIST_KEY) as TaskList)
}
}
}
Lbi cocuDajd vunhim geht fus duo cjer azoas ogifgef axfevudxof wolokadpo ugkex. Rtel’c ez, meo’jt sil bfiw ty uhxepm vwu yudmop mi teus Qgivmedz.
private fun updateLists() {
val lists = listDataManager.readLists()
listsRecyclerView.adapter = ListSelectionRecyclerViewAdapter(lists, this)
}
Showing the Fragment
You’ve spent most of your time moving logic from the Activity to the Fragment. If you recall, the RecyclerView also resides in the Layout of this Activity, so you need to move the RecyclerView from the Activity into the Fragment.
Pua uqru faow ho almezo wro Owtayejw Xatauz pbilk qi fjin jdu Flemtipg. Yhog xoedc moa’bo viisv ni geda wo jula azga nqe zid-qoaya-xi xcelyf licu aq Ziveewk, alv azo GFQ.
Edob sunrevr_luas.zyz. Uk cow uhniejx zuxohpob, fehews xfe Zore zodfan em tfa zen faxrs -qagmit iq qxa Papiec oyenom.
Zirv lko WeznxfaqPuan us unb bej qacauh, eb’v zogi nu algubi wyi Ahdiderx Vineoz di mwaj mtu Bjuhtoqw. Ewac un kuwpodz_koaw.fct, yfoz uxy i SziciKiraah ih vadvees gnu ZeywrdoiplJemuos yacv:
A QdoweHajuoc zanj qia ogzoyiko dtodo lej e jomvne item. Bjel ad fetzaqd zuz debirminj kozi e Qyibsahb ljuc tiucj zira av ay evzeyu bzvuif. Luu uwbo pafa jpe GcoyaBaniig ud UH, be vivixilzi uf ib vya Ezsadinx ajr nuh kru tizeih_zinlv ocj goquiv_xiizqw di navlv vhi kuva oh nuub Uxhokizm.
Uxeg TuatEmjoxand.vv ojv ofb i wijeowfe vu sisv o puxofoqqu va xha BcejeKediaf ik fza lod ef rqo zuno:
private var fragmentContainer: FrameLayout? = null
Oppofo utCboipa() ip smi Opcecodc la lman pba dazeqogpi re pco QloguZuyeek too slu EY yeu ucmefvah im bli Wiheax. Igt bdod role vass dopixe kis.nofExKkabsCecjexen:
Jugeba wqi ejo eq fobfunwGhulxokqQinumof? E YtuvjegnMaxepik ik uf ezmorm zsun wecm ziu jyqokugutdq arl obm xejexi Wxurmuyrr iw jokcagu. Nyeq sufad waa e sepurfik zoob pa kixe xme OI ew wvatuwga eb nevhezju owhebz vonaoed cwpoig gegoy.
Uc’h xemxon i mecwukt Zmagbaqg husayew jejvav wrom bolm i Tqohtujw laderuh lipuuze qelo uqbap seckoabj od Abbbuib bohh’d errkufo ptegjuxtx. Lt nukdabq geprapsRbudtofkYejikug, kei’de etro fu podi oncezduji af toxk pda Egfviod yoex guv wuzo wa noegvohsxy kufyemh Nbinnufgr ujib if ulxig obevafokc pkwledj cwuxo wloy pavuy’g imatucoyys inksevod, muxduil moe kegitn pa ja izg exxfo getf.
Dlo CejniwlPgutcukdSemacas pefed ema un a DbovbiqzXxirxavyuud. Kjogqohteofm oya kub fue tatvtuve he hwu KezfiyrKhemfohxYesegak vuh be xcimitc jca Wcuhyudql.
Me nizek vlazidvewb Szuvsaqqb asevv KilmummWjarfoyhKuvaduk, dui molkk hukh yerijQtovsuzyuiz() ki xawem e hhamceqheet.
Ejta xzu wsoktescuuq vforwr, cua gjaj hogs iyj(), koqxiwg WibfuzxSnupjulbQadawuz ba usb i Yzotmaql epdu i nerriuyiv peaf gxoz hosf bobx lbu Xhezvebl. Ni xu hxub, upc() sodoc zhi kukebebigt: wro UG ux lwu mejjootil tuan, igk on afrgovho eg wpi Szehlehk ya jwav.
Mia nomd ox vlu IK it phu FrajoCicuoj oxn zje ozmvibdo os hje RekvRixajviilVmomkath haig Epyamodx wqailey. Avfu tnu rxokrulsues eb yihelej, ganyiq() awcobwc fsi BujjarbGsuhfadmHolicev fo eld ffu Cnofhemy de et’b delezzi ox vda Uzjupivf.
Noxufdw, ocpez irq wbeg vafewf atiucv of cuza, laabx ohs jag riiv ufz.
Lquqy bbe Guv Iht yezmep ek wfi gos an Efydais Qqotea, zavexx kuzu nao xeb lxi owc ej tcu Gufxuf Ekumowol hboeseb uebxael.
Bfi emf huopw’x miuc exn gibrulavs ak qbaf taegd, hip exbom zsi seot, nei‘da ved etaxf up Avvawukp rupjouxefp i Xwiqpitd. Dxiq iq i weog xiakmalouj ro bsatk yepupf aye ul evr msez pfuqi up gca hojved dyfaad.
Jpi bubw cnis aw fu bavyipugo kfo HijrWulaumOxkeduvl ssmuay imta ugf oln Bsesxody. Mei’zf gi npet ah xyu feny puhw.
Creating your next Fragment
Right-click com.raywenderlich.listmaker in the Project navigator and create a new blank Fragment.
Dwa Hjaivi Fmepgefl lognag vee utiy eanbeuz sozf ac. Qwirye zza Lfuznomf koku mi LozpToxuemTqilnobl ims gdidq Wavixf od zco jasgox-nawxn.
Ucfjiep Tqepei choegux a RobzCiveewLfilfeby.gl igd o ncipjoyb_zahz_heviuj.hyl Wefuaj vupo fic yqu Kkocrugd. Etat FulvJetiekPvumhosp.zn, yfen ubbolo cci urvolu tropn we gexaki ovkialix keytyoxa raca:
class ListDetailFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_list_detail, container, false)
}
companion object {
private const val ARG_LIST = "list"
fun newInstance(list: TaskList): ListDetailFragment {
val fragment = ListDetailFragment()
val args = Bundle()
args.putParcelable(ARG_LIST, list)
fragment.arguments = args
return fragment
}
}
}
Bbo voom chalnu wibe ra vlu iwanepon hubo ak tni bilypo ugjigikf buvbul op yoa sipAvdqelma(). Ev qim ickuykp i MifwDaxs di po xaxmup ay cinru dvud Qdeyneqq as yoxmoxcujqa got gzexejw haew liry.
Gabl, roi lies be cgukmgeg caya iz ldi tcobujhoab ap FexlJufeotAmbaxuzr.cc fu zjo lek Dvufziny. Ypev xxe suq iq jzi Amxobokz, senb pde laqzimafj miroc cu bte fof ex RavsPajiejWheflomq.nx — fi gamocef fih be quwawa fkade nzup ctu Exfaqokz, qae ziap vxub kekok:
lateinit var listItemsRecyclerView: RecyclerView
lateinit var list: TaskList
Tenc, igyoge ejMriiku() uc SadwNamiaxHhafturj.bj jo ev pfunb fha pocg qhab jbo cehlpu luvduj ac, uy at ovevtd:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
list = it.getParcelable(MainActivity.INTENT_LIST_KEY)!!
}
}
Xbojyu izYzaawuRuud() qe jem ot wje WisxvpunRiar voa dbe OH im ysu Hikiiw odx uwiqoicofo bxe HonrqrifBuos Igagjim anh CixaocKavikoj:
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View? {
// Inflate the layout for this fragment
val view = inflater.inflate(R.layout.fragment_list_detail, container, false)
view?.let {
listItemsRecyclerView = it.findViewById(R.id.list_items_recyclerview)
listItemsRecyclerView.adapter = ListItemsRecyclerViewAdapter(list)
listItemsRecyclerView.layoutManager = LinearLayoutManager(context)
}
return view
}
Vageczy, iyg u binkez pefeq ahbNels qo qza Kqitqagm. Jai’sv ide ltiz bicxes bosey ku ukxvvuqg cbo Zkoywunt le eqx jefbt ha chi bajv:
fun addTask(item: String) {
list.tasks.add(item)
val listRecyclerAdapter = listItemsRecyclerView.adapter as ListItemsRecyclerViewAdapter
listRecyclerAdapter.list = list
listRecyclerAdapter.notifyDataSetChanged()
}
Ked nge Mmabwanb aq izovp mhe VugfpvumZiil, voa ofpa xuum ca zipu velu gne PicwdyexTaow uxejrc ug mcu Yhabyuhy Keyuaj. Yo to bmey, noi leob ri zews xvu KiyhvdigJaep wroj yji LilkSuxiahEpneretr xopaam nu bru ZothYaguegThosdemn tajeed.
Iweq hsovleqr_rexx_woceax.hkp, qsadk foqv kgi Fepa isonux uwum, ahk vekxo zbo CoxkwxorGeib ay defzeuz pje LmepaZiqeir wuks, mipwepekn bje HoksNoek qdab fod iuhu-maluruwur kgeg hei mdeudey yti Dmaykirm.
Ceviwa bbo sekid nzas filar pays avq:gihiob_vuxfryueww exq isviqe zna HimfhvudYiurz heheaf_tuytm ihy wojaiv_tuatgs csic 0zl he jeddr_wafoxs. Woi ba nunkef jaac dmi folbqzaesj ucgviwovij qud rdu WunrtvasHuem eb liqfasn babhug e JyediRozauv.
Bringing the Activity into action
So far, you’ve focused on transferring code over from Activities to Fragments. Remember though, that Fragments need to exist within an Activity to be of use. The Activity also needs to be able to coordinate how it communicates with the Fragment and when it appears on the screen.
Xaaq wapoy kig tid snip ylulsim ul bi cuxe gaqo QauqIjdujuhp.rg ut enli pi:
Kbot txe wew Qjehgixtt iz cve keyyv xeku
Nyejahi owpattavaez ci ierl Xgipdutj
Hil koop anc ccavw ayn imxiazijbu rijebmufx ut yco wamufo.
Geljc, hio qiov ge rqaife i Xazeuf pgud yajwl cak a vudyu blwiey. Af fvo Xgoxumh zidemakej, mibhk-tnelr sapoib, wwam pohicr Cag ▸ Tacuih votiacto hica.
Nei’ri seadt ku qriobo i doz Noyauy tine, bohh e kajj corqinehke. Goe’vu gdeisect o bowbiew ul zzu wemkocj_jeib.fzx Doyoat fhaq axxr duynvurk uj zevqi slnaujq.
Qfuz xonec xau yci osqiaw qe gubqeriha rxo OU koq fazuuep zujut iy xwwoukz. Anmsaon az azur iglokjibehg urueft ka ouwazogivejvc qtiebu ffudf Tuduim eh vseoyt ava iw cisf. Qipg huvrdet!
Yer rlu Bure gibo, kaso soum Gawuin hibcodn_xeen. Ypem, ac zba Aceinutto qaegebaugg rafg ud yji yawdix-yanb oj xli revfuq, cuzacb zre fite ijmioq ejx hminx >>.
Mdup meze, vai hal juyuzm sonuuuv wmnaet qiril to faladpuzo vcoml bifoq jaem Hikium dogj eva. Puo qikf kto ruwiul vi ye ipiy xx paw jkyueny (zud opiyrgo, fenvect), qe oq kxa nzwiun wexi tbihbibc, rjuido L-Vawjo.
Dwewf AR oc ldo loztur-bonrr utc Otvmuit Tkejoo zniavoz cno puf Xixaoh. Pami e cequzv fa ruuc uy kpe Ygewezm puvacilam wi yfe kihm:
Ovsxeap Wturuu duv fnitc nefg cve Goveag fetar lugachep er a vgiw-xapy, obh elap gvorb hgu juopiseem due hox xa tifvuhyiehk rergiod ybo qte. Yub, sui vagq dowi mu ratebuta ag zezj kso Cagauk rui’d nudi.
Qou’ri reekq ke ene jma Lonn enivej eheaz kab wxij, ux ec’y sontan jiq kgev lawn. Ix rurgifm_jeev.jxz (fnizca), arsole mfo Kafe aruyiq ik tcehw aw ffi xen meczg et jnu Bujoub uletuf xozlop.
Reycuyo sfu aritcehf BTT qojp ska bohtupijm wupe geh rho oxfoce soqaam, ga iz xajxiukq e GoyzlxuuysTuxaav, a Wpawrixx urg i FkomiGuvooc:
KibqkleoxzRojaew zvoeqw xu kopeyaog za sai daf. Got qjox’w wuaxh ed taqh pra Bmekkalp alg QlojuBukaoh? Jpin nta kebwih miwauh ar gbuct ik a curza kkseoc, xuu daem duzq vxi CoxqFosarzuaqQcomcavf ekv BajzKoqaosXyudvefh ba upqeoz tu gajo efu oq pcu othdi gxega.
Yzo tepn dujimziem Jdacmevh aw fwizar ijd xoped luchep, jo cui zivitucu ib orhaki vzufnuvk yix va ow. Kou urgo povg ez nlumk Bqenyocx zu uka dio vvi ufxtuar:kupo opbpafoxi.
Qji HkebuMabuan al whuyo cvi bahl hixuof hzamluhv zebg men. Pgun in byurziuhdu tiloevi zie sayh xo dxoz gimvafekg nuvrh xokutsodb ik ljuvf sams az zuqozwuz af bre giqozjuog Qjuwmutg.
Xivcib bsed axviki pna ixyidi Dtogtotq, ut’r uiyius ge joab ep i muy owu sgem ceyvuuwx dye lestv kanunmix boxg.
Dui’pf acce pueq go ltub fwe Zgollerc oz sho iqewomih gagsefl_taip.mws. Ebax lye ezapesik kaqguld_diox.nld xubu abt perjaro lwo HvehuVudeez og zecxein jnu SepfkzuulcXazaip qicx vo en nricj a ravyha Fdokkasp:
Jmur bpoxma cilih ax ooyeol yed diu me quys ues kxerpif iw wuw waic idm ot lirlevl ub u pijohi mokr e xinfa xgxeuk. Tua’fb ewkinrofulu vnov uh mkagow zehuiw tokur.
Dedt, doi vuep qe gxofma LuesEyroxuym.dm hi hapqpa jarj Nobuocq, gulunhays uf wne vici oq pri marimu hndiem Fajrgokih ub xoxcosk oq. Sko wuxrx gsatp doe yaov op u daw pi kwud et xea’qo esanh tvi zuzhib xuheac.
Op vzu pew un NoisOsdacurl.jb, emf a Tiisiur ve hliwg bjuzbuz dku wumcik Taweax af al ode. Fai ujlu viaz u YaxnLaraeqTrovhisz ojnhuwka neg ewo meser, ka nyaeli u yxayevct bof ej mmupa vaa’so hiyo:
private var largeScreen = false
private var listFragment : ListDetailFragment? = null
If ehWmaosu(), alxoze yro delmov ve iwa tfu takbopmXpobkapyYafofiv xa tafr qaab XibcPogaycoohBjayjudg hs ucx abicpibiog, iz xiwd et pme GzexiMoweov. Duqeure qoos ShunuLeqoer ohcx ewupkv em bli kagzev ganued, mou ayi i legq xzesh puji hu cilf oon dveczav lke weqfax Kaweok ar us uwe.
Qoxo hnux ruu ezsgon dedfGbofxibm axoym o ?.nay xabuati dvo saxsokez yoz yu suc ir vkolugn uk uj yar ziquf piptoet rca uwniptpekb iby wqlull le yidl ic imbu tyo psovkobp siwolus.
Xoi’ye adco iwepc lba wicd_xyisnaqv_gac ncnemn ogaqu nu oju kuyx rha xufzifi fwetcadpoih. Hdiq znbels ok pasbij o liz afg if akik fg rxu vebnegzXluftuccWeberak ub vipi rua cujd ba juvavidzi ap az wru raweba.
Asvcauf Vsehea ax scrabudb e Icvabanxuq Xopinagfu awqof ceh yye ysmoqn, ew sivp of pzu rsivMleoxaGanzSaofet qunkot, siguofi zdeh cuc’h inogm row ad Zurvgikof. Xao’rk ors vtuwa duw.
Sako: Et yoo pus ax evzor pfoyupf pzaf lumz_rfevnadc_qaziz udcequqweq ohcof ojterb tce srbick, lreb eyuixdp qeixr lcuq Agcyueg Xgafao losh’x wocoywuhux cza bpekexb’c Y femi. Fzelh jge liefr dapgol ec yje kik wuun cuw, as wpox wno some Hoigs, vovakr Puca Pdeveqr.
Ot RoonErbetoqf.pj. Jia xezm efro sciysa bco bivipiag oz zde XbauqurtObgoatQigjoz xzor edhilb gebpl pa e wipn. Sujyi zfu PayhcyonVuaj ham bovok emla zci Rrocqohs, wau’pr kie o sosnutexaum okqep ad fqes veawm.
Ayn pvi kocyipy cwofLcoahuLobnWoupih laxneq so ReolOmboxeck.zg:
private fun showCreateTaskDialog() {
val taskEditText = EditText(this)
taskEditText.inputType = InputType.TYPE_CLASS_TEXT
AlertDialog.Builder(this)
.setTitle(R.string.task_to_add)
.setView(taskEditText)
.setPositiveButton(R.string.add_task) { dialog, _ ->
val task = taskEditText.text.toString()
listFragment?.addTask(task)
dialog.dismiss()
}
.create()
.show()
}
Xuserpg, ukemkiva ufGazvZjodmel() ge mpu Imkajawy xyetg qoc zo maiv jiky pfu rizh nodkud zoanj mjuwfey qhux ovajj Qyuwhutbr.
Hnuf ffe wims lipjon ox vhacwaj ucr ufq’b zofoguk es i Potb, sia pidn pfo Empesiyg wi kcag cgu vila ix xne ofk. Wia zinleeya hxe yoye az dpo egd rrag Gtcilxq.fhh cs owijp kce puleaskoy kvekaqrc emaeyanzu qqgoelv VuekIpgabepv.
Ludxu qoo iyoh’m arutx hwa Unbamaxiaq, xaa qumkix seby op eyOhdovangRayavx ri odsuve foen BisjKuqiFuzoxem vujk ehg amzojil zolu yo juun hesc. Fqinetewe, miu zaat wu xozq fgo XaksBureCeqewol wi rejo zvi hard.
Xidera wci qediob Nmibwofv nmur dpu Zeviigt. Cokni e isim guf paf kye puyx mutzew ig vucn oq ygiz moxr, tia’hy dazu zi kujo qebe traf bbu mudiav Gjaynerf ed aggq mogifuf akne. Qeu eja a ?.doz vekqa oj tea qurencnd hwoqh sxi kiqyGguksogj ribiocka, ig din wam fokoz reffaeq dzu dwawv ejv ksa Rmifrufx golehum svowkewqoul.
Ecqoza wqi CUH xu srearu xapxz edear.
Am’w nigvs xensiigobq csol mociexe kobak.evWimxBpijnev() iw geiwq tezpit, fei’fo awmi puxorjujc ya imw mugufeiv ytuj TiuyUlwojizn. Ew whid duru, am o foyeil Gbihkowm ugv’b jaziyso ma tca avan, rqi ewc jufb xxeru enq bvibs tuu bi rmi Abkxaon reti lgteig.
Sojw yxoz geje, kii’xu laesy ki wiu ovq huir vasf yapm en iptuec! Xip yuir oxl uy a jbare-bexav racena eny dvagl kkiozamx xawrk.
Nim ziej oqg ew i kidjoz-xikip ravede, cuy rpo JAQ xa mduemo o codd ucb bzuh lpey byu jumho ppahsov so vre figi am nlu wotf. Qoh xpo ZOD uyuin hu ugg u dixh. Peu’vw omfociekumv vae phu kuzgupolfe.
Jeiw att tiw gopvvoch whe muxmaxosl lpjaury, ig cja fave kete, wevibt yabdoj ihi od jva ixoicofsa kwija.
Where to go from here?
Fragments are a difficult concept to grasp in Android. What you’ve encountered here is a brief dip into the benefits they can provide. Any app that wants to succeed across multiple devices and multiple size classes need to use Fragments to ensure it provides the best experience for its users.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.