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

android pre requisites 2
SMART_READER_LITE
LIVE PREVIEW

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 .


slide-1
SLIDE 1

1

Android ¡Pre-­‑requisites ¡2 ¡

slide-2
SLIDE 2

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 ¡

slide-3
SLIDE 3

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 ¡

slide-4
SLIDE 4

4

Ac>vity ¡Lifecycle ¡

3 ¡Life>mes: ¡

En>re ¡

  • nDestroy: ¡Free ¡resources ¡

Visible ¡

  • nStop: ¡Stop ¡updaEng ¡screen ¡ ¡

Foreground ¡

Has ¡user ¡input ¡focus ¡

  • nPause ¡called ¡on ¡device ¡sleep ¡
  • r ¡when ¡dialog ¡appears ¡

¡

Note: ¡onPause ¡is ¡the ¡last ¡call ¡you ¡

are ¡guaranteed ¡to ¡receive ¡before ¡ being ¡destroyed. ¡

slide-5
SLIDE 5

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 ¡

slide-6
SLIDE 6

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(); ¡