Android app development Beginners Guide

Page 1

AndroidAppDevelopment FundamentalsforBeginners

Androidisanoperatingsystemdesignedprimarilyformobiledevices. Googlecreatedit,whichisbasedontheLinuxkernelandotheropensourceapplications.It'scommonintouchscreenmobiledeviceslike smartphonesandtablets.However,theyarenowemployedinAndroid Autoautomobiles,TVs,watches,cameras,andotherdevices.

AndroidOSwascreatedbyAndroidInc.,whichwasacquiredbyGooglein 2005.ForthesedevicestoworkonAndroid,varioussoftware(apps)such asgames,musicplayers,cameras,andsoonaredeveloped.TheGoogle PlayStorehasover3.3millionapplications.Theappiscreatedusingthe AndroidStudioprogram.Theseexecutableprogramsareinstalledthrough anAPKbundleorpackage(AndroidPackageKit).

Inthisandroiddeveloperguidepost,wewillstudythefoundationsof androidappdevelopmentfundamentals.We'lllookintoAndroid components,essentialconcepts,andmuchmore.However,beforewego intothedetailsoftheintricatefoldersandtheirsignificance,let'sgoover whatAndroidis.

WhatisAndroid?

Androidisamobileoperatingsystemcreatedbyagroupofdevelopers (mostlyGoogleandtheOpenHandsetAlliance).Theoperatingsystemis writteninJava(UI),C(Core),C++,andotherprogramminglanguages.

AndroidOSisaUnix-likeoperatingsystembasedonamodifiedLinux kernel.Itisintendedparticularlyformobiledevicessuchastouchscreens, smartphones,andtablets.ThefirstcommercialAndroidsmartphonewas introducedinSeptember2008,afteritwasrevealedinNovember2007.

Since2011,Androidhasbeenthebest-sellingsmartphoneoperating systemglobally,andontabletssince2013.Theoperatingsystemcurrently hasover5billionmonthlyactiveusers.

AndroidProgrammingLanguages

We'llstartwiththeAndroidprogramminglanguagebecausenothingis possiblewithoutit.Androidappsmaybewritteninoneofthreedifferent languages.Java,C++,andXMLarethethree.Thebackendoftheprogram isdevelopedinJava/C++,whilethefrontendiswritteninXMLmarkup language.InadditiontoJavaandC++,anewlanguageknownasKotlinhas recentlygainedpopularity.

Javaisanobject-oriented,class-basedprogramminglanguage.Oneofthe reasonsitisfavoredforAndroidappdevelopmentservicesisbecauseitis builttorunwithfewdependencies.Javaisageneral-purposeprogramming languagethatallowsdevelopertocodeonceandexecuteanywhere.This impliesthatJavacodethathasbeencompiledcanbeexecutedonany platformthatsupportsJava.

1.Java

C++isanotherprogramminglanguagethatmightbeusedtocreate applications.C++isageneral-purposeprogramminglanguageaswell.C++ wasinitiallyintroducedin1985.Thelanguagehasundergoneseveral revisionsovertheyears,andcurrentC++isobject-oriented,generic,and functional.

XMLisanextensiblemarkuplanguagethatsetsstandardsforencoding textsinahuman-andmachine-readablemanner.XML'sdesigngoals includesimplicity,universality,andonlineusability.

4.KOTLIN

Kotlinisacross-platform,general-purposeprogramminglanguagethatis completelycompatiblewithJava.Kotlininitiallysurfacedin2011,and GooglestatedinMay2019thatitisnowtheirpreferredprogramming languageforAndroidappdevelopers.Thelanguageissupportedby platformssuchas:

Android,

iOS,macOS,watchOS,tvOS

Windows,

Linux

Javascript

WebAssembly

LLVM

AndroidAppDevelopmentFundamentals

Androidappdevelopmentservicesbecomessimplewhenhireandroidapp developersorappdevelopmententhusiastsunderstandthecoreideas underlyingappdevelopmentbyandroiddeveloperguide.

We'llgothroughthefoundationsofAndroidappdevelopmentservices. Wewillgothroughtheappdevelopmentcomponents,thelanguageskills

2.C++ 3.XML

necessary,theoptimumapplayout,andthewholelifespanoftheAndroid application.

AndroidComponents

ConsiderAndroidappcomponentstobebuildingblocksfordeveloping Androidapps.Eachcomponenthasadistinctrole,andeachcomponent hasitsownlifecycle.Someofthecomponentsareself-contained,while theothersareinterconnected.Therearefourimportantcomponentsthat weshallexamineindepth.

Activities

Activitiesaretheactionstakenbytheappwhenauserinteractswithit.It isconcernedwithuserinterfaceandscreeninteractions.Theoverall numberofactionsisdeterminedbytheapp'sfunctionality.Whentheapp islaunched,thefirstactivityisdone.Asaresult,everyappconductsat leastoneaction,whichisreferredtoasthe"MainActivity."

Theactivityiscarriedoutinthefollowingways:

Syntax:

publicclassMainActivityextendsActivity{

Theapp'sbackgroundactionsarereferredtoasservices.Itmaybe listeningtomusicwhileusingGoogleMapstogotoyourlocation.The majoraimofthiscomponentistoensurethattheprogramruns continuously.Tocompletetheresponsibilities,theservicemayrequirethe assistanceofanothersub-service.

publicclassMyServicesextendsServices{

//codefortheservices

//processes } Services

Broadcastreceivers

Whenrespondingtomessagesfromotherapplicationsorsystems,a broadcastisutilized.Broadcastreceiversreceivethebroadcastand respondappropriately.Whenaphone'sbatterybecomeslow,the SystemOSsendsabroadcastmessagetostartthebatterysaver,andthe appperformstheappropriateactivities.

Eachitemisrepresentedbyanintentobject,andthebroadcastreceiveris asubclassofBroadcastReceiver.Thebroadcastisreceivedbythecontext, andthepurposeistheconsequencedependingonthecontext.

publicclassMyReceiverextendsBroadcastReceiver{ publicvoidonReceive(context,intent){

Contentproviders

Whenoneapplicationrequestsdatafromanother,contentprovidersare utilizedtosendit.TheFacebookapp,forexample,demandsaccesstoyour contactsandmessages.TheContentResolverclasshandlesandmanages them.

ThisclassmakesuseofacollectionofAPIs(applicationprogramming interfaces)thatallowotherappstocarryouttransactions.

publicclassMyContentProviderextendsContentProvider{ publicvoidonCreate()

}
}
{} } Conclusion

StartwithShivTechnolabshirededicatedandroidappdevelopersifyou're newtoAndroidappdevelopmentservices.Asaresult,understandingthe foundationsofAndroidisimportant.Todevelopapplications,youmay utilizeeitherKotlinorJava,orbothatthesametime.Youmustbefamiliar withtheandroidappdevelopmentfundamentalsandsyntaxofoneorboth oftheseprogramminglanguages,aswellasthecollectionsystem, concurrencyandmultithreading,generics,andfunctionalprogramming.

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.