Sihlela ukubonakala kwakho! Ukusebenza okuhle nge-ONMA scout ukuthuthukiswa kohlelo lokusebenza lwe-android kuqinisekisiwe.
Oxhumana nayeUma ufuna ukwazi okwengeziwe ngezinhlelo ze-Android, le ncwadi izoba wusizo kakhulu kuwe. Izokwethulela izihloko ezibaluleke kakhulu okudingeka uzazi uma wakha uhlelo lokusebenza lwe-Android olubukeka njengochwepheshe. Kusukela ekugcinweni kwedatha kuya ekucutshungulweni kwedatha, izinqubo zangemuva, kanye Nezinsizakalo Ze-inthanethi, leli bhuku lizokukhombisa konke odinga ukukwazi ukuze udale uhlelo lokusebenza olubukeka njengochwepheshe. Incwadi izokusiza ukuthi ufunde ukusebenzisa i-Android Studio ukuthuthukisa uhlelo lwakho lokusebenza.
Ukusebenzisa i-Java ukwakha izinhlelo zakho zokusebenza ze-Android akunzima, njengoba ilandela ulwazi nokulindelwe ngabahleli bezinhlelo ze-OO. Le ncwadi yokufundisa ifaka izisekelo zokuthuthukiswa kwe-Android, okuhlanganisa izinhlelo zokusebenza ezibonisayo, izakhiwo zomsebenzi, ukulungisa iphutha, ukuhlola, kanye nemininingwane yolwazi ye-SQLite. Uzofunda futhi mayelana nemiyalezo ye-Android, Ukucutshungulwa kwe-XML, JSON, kanye nokulutha. Uzothola ukuqonda okuhle kobuchwepheshe obuyisisekelo, kufaka phakathi i-Android SDK.
Izilimi ezimbili ezivame kakhulu zokuthuthukiswa kohlelo lokusebenza lwe-Android yi-Java ne-Kotlin. I-Java ulimi oludala kakhulu lokudala izinhlelo zokusebenza, kodwa abathuthukisi abaningi baphendukela ku-Kotlin ukuze uthole i-syntax yayo emfushane yekhodi kanye nokufunda kalula. Java, kuyilapho kuwulimi oludume kakhulu lokwakha izinhlelo zokusebenza ze-Android, isalokhu idume ngemitapo yolwazi yayo ebanzi kanye nokuhlanganiswa okuhlukahlukene. Kotlin, Ngokwesinye isandla, yakhiwe ngabakwaJetBrains, inkampani efanayo eyakha i-Java.
Ukuhlela okugxile entweni kuyindlela yokuhlela idatha ngendlela enengqondo. Into ngayinye inedatha yayo nokuziphatha, futhi zonke zichazwa ngamakilasi. Ngokwesibonelo, ikilasi le-BankAccount lingaqukatha idatha nezindlela zokugcina nokususa ama-akhawunti. Lezi zinto zizophinda zibe nezindlela ezifana ne-deductFromAccount() kanye ne-getAccountHolderName(). Lezi zindlela zibalulekile ekusebenzeni kahle kohlelo lokusebenza lwe-BankAccount.
I-Java ulimi lokuqala olusetshenziswa ukwakha izinhlelo zokusebenza ze-Android. Kodwa njengoba i-Kotlin ithole ukuthandwa emhlabeni we-Android, izinkampani eziningi ezinkulu zobuchwepheshe ziphendukela kulolu limi kumaphrojekthi azo. Twitter, I-Netflix, kanye neTrello, zonke zakhiwe ngeKotlin. Kodwa i-Open Handset Alliance yasebenzisa i-Java ku-interface yomsebenzisi ye-Android OS. Nakuba i-Java ingahlanganiswa ibe yi-bytecode futhi isebenze ku-JVM, ayinazo izinsiza zokuhlela ezisezingeni eliphansi njenge-C++.
Ukuze uthuthukise ukusebenzisana nezingxenye zemenyu zezinhlelo zokusebenza ze-Android, ungasebenzisa i-ShareActionProvider. Le labhulali idala amamenyu amancane ashukumisayo futhi yenza izenzo ezijwayelekile. Iziveza yona kufayela lensiza yemenyu ye-XML. Ngokungeza le labhulali kuhlelo lwakho lokusebenza, ungabelana ngedatha nabasebenzisi bakho, kufaka phakathi amanani esitoko. Ukuze uthole ulwazi olwengeziwe, vakashela iwebhusayithi esemthethweni. Nawa amanye amakilasi asetshenziswa kakhulu e-ShareActionProvider:
Isigaba se-ShareActionProvider sisebenzisa i-ACTION_SEND-Inhloso ukwenza isenzo esihlobene nokwabelana. Uma umsebenzisi achofoza isithonjana sohlelo lokusebenza Kubha Yesenzo, uhlelo lokusebenza luzobonisa uhlu lwezinhlelo zokusebenza zokwabelana. Uma lesi senzo sokwabelana sesiqediwe, uhlelo lokusebenza lubuyisela umsebenzisi kuhlelo lwayo lwe-Android. Ukusebenzisa umtapo wezincwadi we-ShareActionProvider kulula futhi kulula.
Uzodinga umhlinzeki wesenzo sokwabelana wezinhlelo zokusebenza ze-Android uma uhlela ukwabelana ngokuqukethwe kuhlelo lwakho lokusebenza nabanye abantu. I-Share-Intent iyingxenye ebalulekile yokuthuthukiswa kwe-Android futhi inikeza elula, indlela esebenziseka kalula yokwabelana ngolwazi nabanye. Kubalulekile ukuqaphela ukuthi i-ShareActionProvider idinga imvume yokufunda nokubhala idatha. Ngephutha, kufanele ube namalungelo okuphatha wohlelo lwakho lokusebenza.
Ukuze usebenzise lesi sici sokwabelana kuhlelo lwakho lokusebenza, udinga ukungeza i-ShareActionProvider kubha Yesenzo. Khona-ke, dlulisa okuqukethwe kokuthi Umsebenzi futhi i-ShareActionProvider izokwenza okusele. Ungakwazi futhi ukusebenzisa i-ShareActionProvider kuhlelo lwakho lokusebenza Lwegalari, okuyisibonelo esihle sokukukhombisa ukuthi ungangeza kanjani lokhu kusebenza kuhlelo lwakho lokusebenza. Ungafunda kabanzi ngale nto kumhlahlandlela wethu Webha Yesenzo.
Uma udala umsebenzi omusha ku-Android, kufanele usebenzise i-Activity Lifecycle Callbacks ukuze uqinisekise ukuthi iyaqhubeka nokusebenza ngemva kokuthi umsebenzisi eshiye uhlelo lokusebenza. Ukusebenzisa lezi zindlela kubalulekile ukuvimbela ukuvuza kwenkumbulo, okungehlisa izinga lokusebenza kwesistimu yakho. Futhi, uma usebenzisa lezi zindlela, kufanele ugweme ukwenza izibalo ezijulile phakathi ne-OnPause() ukuphinda ushayele ngoba kungabambezela ukuguquka ukusuka komunye umsebenzi ukuya komunye, okungase kuholele ekubeni nesipiliyoni esingesihle somsebenzisi.
I-Activity Lifecycle Callbacks ingakusiza ukuthi ufinyelele lo mgomo ngokushayela izehlakalo ezithile phakathi nezigaba ezihlukene zomjikelezo wempilo womsebenzi.. Okokuqala, onYakha() kubizwa uma umsebenzi udalwa okokuqala. I-OnStart() ukuphinda ushaye ucingo kuvamise ukulandelwa yi-OnResume kanye ne-OnPause. Ezimweni eziningi, i-onResume callback ibizwa ngaphambi kwendlela ye-onStop.
Uma umsebenzi umiswa isikhashana, i-OnPause() indlela imisa bonke abalaleli bohlaka futhi igcina idatha yohlelo lokusebenza. I-OnPause() kanye ne-OnStop() izindlela ziqinisekisiwe ukuthi zizobizwa ngaphambi kokuthi umsebenzi uphele. I-OnResume() indlela ibizwa lapho umsebenzi uqalisa futhi ukucushwa kwawo kusho ukushintsha. Isistimu ye-Android izophinda idale umsebenzi ngokucushwa okusha. Ngale ndlela, abasebenzisi bohlelo lwakho lokusebenza bazokwazi ukuqalisa kabusha umsebenzi wabo futhi bawusebenzise.
I-Activity Lifecycle Callbacks iyindlela enhle yokuqinisekisa ukuthi uhlelo lwakho lokusebenza lusebenza ngemuva. Lokhu kuphinda kushayelwe kubizwa noma nini lapho umsebenzi ungena ngemuva. Ungakwazi ukukhipha le ndlela ngokubiza indlela ku-super class. Khumbula ukushayela le ndlela uma kudingeka njengoba ungayishayi ucingo kuzoholela ekutheni uhlelo lwakho lokusebenza luphahlazeke noma lubhajwe esimeni esingajwayelekile. Nokho, qiniseka ukuthi ushayela i-OnPause() indlela lapho udinga.
Uma uthuthukisa izinhlelo zokusebenza ze-Android, kufanele ucabange ukusebenzisa ithuluzi lokubuyisela kabusha. Amathuluzi okwenza kabusha ayatholakala ngesitudiyo sakho se-Android noma injini ye-Xcode refactoring. I-Android Studio inikezela ngezindlela ezahlukahlukene zokuphinda zenziwe kabusha, okuhlanganisa ukuqamba kabusha amakilasi e-Java, izakhiwo, okudwetshwayo, kanye nezindlela. Lawa mathuluzi okwenza kabusha anezinhlobonhlobo zezinketho, futhi sizohlanganisa ngayinye ngokuningiliziwe ekuphekeni ngezansi.
Amathuluzi okwenza kabusha wezinhlelo zokusebenza ze-Android angathuthukisa ikhwalithi yekhodi yakho futhi ehlise iphunga lekhodi. Ukuvimbela imisebenzi ye-I/O kungaba nomthelela omubi ekuphenduleni kohlelo lokusebenza lwe-smartphone, nokusebenzisa ukwakheka kwe-async okungalungile kungabangela izinkinga njengokuvuza kwememori, amandla amoshayo, nokumosha izinsiza. Amathuluzi okwenza kabusha ayatholakala ukuze asuse lezi zinkinga ngokufaka kabusha ikhodi ye-async ibe ikhodi elandelanayo. Ithuluzi elenza kabusha njenge-ASYNCDROID lingakhipha imisebenzi esebenza isikhathi eside ku-Android AsyncTask.
Amathuluzi okwenza kabusha wezinhlelo zokusebenza ze-Android angaphinda athuthukise izinhlelo zokusebenza zedeskithophu eziyifa. Bavumela abathuthukisi ukuthi bashintshe i-codebase ngaphandle kokuthinta yonke impilo yohlelo lokusebenza lweselula. Ngaphezu kwalokho, Onjiniyela bangakwazi futhi ukuhlanza izendlalelo zekhodi ezikhethiwe, ngalokho kuthuthukisa ikhwalithi yekhodi iyonke kanye nolwazi lomsebenzisi ngaphandle kokuthinta umjikelezo wokuthuthukiswa kohlelo lokusebenza lweselula. Onjiniyela abaningi bajwayele umjikelezo wokuphila wokuthuthukiswa kwe-Android, nokusebenzisa amathuluzi okwenza kabusha e-Android kuzolula inqubo yokuthumela izinhlelo zokusebenza zefa kumadivayisi eselula.
Ukwenza kabusha kungaba nzima ezinhlelweni zokusebenza ezikhiqizwayo, kodwa kuwumsebenzi obalulekile wabathuthukisi. Khiphela inguqulo yakho entsha eqenjini elincane labasebenzisi ukuze uhlole ukuziphatha nokusebenza kwayo. Kubalulekile futhi ukuhlola ukusebenza kohlelo lokusebenza olufakelwe kabusha amaphesenti kanye nokusabalalisa ngaphambi kokuya esidlangalaleni. Nakuba kukhona ezinye izinzuzo zamathuluzi refactoring for Android, kufanele uhlale ukhumbula ukuthi kungcono ukugwema ukubhala kabusha ikhodi ekhona uma kungenasidingo ngokuphelele.
I-MIT App Inventor iyindawo yokuthuthukisa edidiyelwe (I-IDE) ngezinhlelo zokusebenza zewebhu. Kuhlinzekwe i-Google ekuqaleni, manje igcinwa yi-Massachusetts Institute of Technology. I-IDE yenza kube lula kubathuthukisi ukuthi bakhe izinhlelo zokusebenza zamapulatifomu ahlukahlukene. Ithuluzi le-MIT App Inventor liwusizo kakhulu ekudaleni izinhlelo zokusebenza ze-Android. Ihlanganisa anhlobonhlobo amathuluzi nemitapo yolwazi, kufaka phakathi imvelo yokuhlela ebonakalayo ye-Android.
I-MIT App Inventor futhi iyisinqumo esihle sabaqalayo nothisha abafundisa ukubhala amakhodi ezikoleni. Ukusebenziseka kalula kohlelo kuyenza ilungele ukuthuthukisa ama-prototypes wohlelo lokusebenza ngokushesha. Abafundi bangadala futhi bahlole abadalile kumadivayisi abo eselula, esikhundleni sokuvinjelwa elebhu yekhompyutha. I-MIT ikhiphe izandiso ezimbalwa ukusiza abathuthukisi bakhe izinhlelo zokusebenza zeselula ezikhethekile kanye nesixhumi esibonakalayo ngamadivayisi we-IOT. Ngaphezu kwalokho, abathuthukisi bangabhala izingxenye zangokwezifiso besebenzisa leli thuluzi.
I-MIT App Inventor iyithuluzi elingasiza abafundi ukuthi bathuthukise izinhlelo zokusebenza zeselula. Inokusebenza okubonakalayo komsebenzisi kanye namabhulokhi anengqondo avumela abasebenzisi ukuthi bakhe futhi bahlole izinhlelo zabo zokusebenza ngesikhathi sangempela. Ngenguqulo yayo yamahhala, abafundi bangahlangana nabanye onjiniyela abanomqondo ofanayo futhi babuze imibuzo. Umphakathi uyaseseka futhi uyasiza. Kodwa ukwenza okuningi kwalolu hlelo, abafundi kumele babe nokuxhumana okuhle kwe-inthanethi.
Ngicela uqaphele, ukuthi sisebenzisa amakhukhi, ukuthuthukisa ukusetshenziswa kwale webhusayithi. Ngokuvakashela isayithi
ukusetshenziswa okwengeziwe, yamukela lawa makhukhi
Ungathola ulwazi olwengeziwe mayelana namakhukhi esimemezelweni sethu sokuvikela idatha