android pre requisites 2
play

Android Pre-requisites 2 1 Unix commands Ge6ng help Use - PowerPoint PPT Presentation

Android Pre-requisites 2 1 Unix commands Ge6ng help Use help flag when running command Type man command Hidden files Begin with .


  1. Android ¡Pre-­‑requisites ¡2 ¡ 1

  2. Unix ¡commands ¡ � Ge6ng ¡help ¡ � Use ¡“—help” ¡flag ¡when ¡running ¡command ¡ � Type ¡“man ¡command” ¡ � Hidden ¡files ¡ � Begin ¡with ¡. ¡ � Globbing ¡ � You ¡can ¡use ¡an ¡asterisk ¡(*) ¡in ¡file ¡names ¡as ¡a ¡wild ¡card ¡ � You ¡can ¡use ¡square ¡brackets ¡for ¡possible ¡opEons ¡ ¡ � [abc]* ¡is ¡all ¡files ¡that ¡begin ¡with ¡a, ¡b, ¡or ¡c ¡ 2

  3. Ac>vity ¡Lifecycle ¡ � Android ¡devices ¡are ¡resource ¡constrained ¡ � Limited ¡memory, ¡limited ¡baJery ¡ � Use ¡a ¡fundamentally ¡different ¡than ¡normal ¡programs ¡ � At ¡any ¡Eme, ¡phone ¡can ¡kill ¡“running” ¡applicaEons ¡ � Later, ¡restart ¡them ¡where ¡they ¡leL ¡off ¡ � Ac#vi#es ¡are ¡the ¡building ¡block ¡of ¡applica>ons ¡ � Every ¡screen ¡of ¡a ¡mobile ¡app ¡is ¡a ¡different ¡acEvity ¡ � Only ¡one ¡acEvity ¡is ¡acEve ¡is ¡running ¡at ¡a ¡Eme ¡ 3

  4. Ac>vity ¡Lifecycle ¡ 3 ¡Life>mes: ¡ � En>re ¡ � onDestroy: ¡Free ¡resources ¡ � Visible ¡ � onStop: ¡Stop ¡updaEng ¡screen ¡ ¡ � Foreground ¡ � Has ¡user ¡input ¡focus ¡ � onPause ¡called ¡on ¡device ¡sleep ¡ or ¡when ¡dialog ¡appears ¡ ¡ � Note: ¡ onPause ¡is ¡the ¡last ¡call ¡you ¡ are ¡guaranteed ¡to ¡receive ¡before ¡ being ¡destroyed. ¡ 4

  5. Context ¡Object ¡ � An ¡app ¡has ¡applica>on ¡state/environment ¡data ¡and ¡resources ¡ � E.g., ¡assets, ¡resources, ¡package ¡manager, ¡preferences ¡ � It ¡needs ¡access ¡to ¡these ¡to ¡perform ¡some ¡operaEons ¡ � Android ¡organizes ¡these ¡in ¡a ¡ Context ¡object ¡ � Context ¡is ¡an ¡abstract ¡base ¡class ¡ � AcEvity, ¡Service, ¡etc. ¡ isA ¡Context ¡ � You ¡will ¡mostly ¡use ¡the ¡Context ¡indirectly ¡ � E.g., ¡pass ¡it ¡as ¡an ¡argument ¡to ¡other ¡funcEon ¡calls ¡ 5

  6. Toasts ¡ � Messages ¡that ¡are ¡temporarily ¡drawn ¡over ¡the ¡UI ¡ ¡ � Useful ¡for ¡user ¡no>fica>ons ¡and ¡during ¡development ¡ � Toast.makeText(view.getContext(), ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡“Hello ¡world, ¡I ¡am ¡a ¡toast”, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Toast.LENGTH_LONG).show(); ¡ 6

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend