More Android 1 How hard was week 9 code review assignment? A) - - PowerPoint PPT Presentation

more android
SMART_READER_LITE
LIVE PREVIEW

More Android 1 How hard was week 9 code review assignment? A) - - PowerPoint PPT Presentation

More Android 1 How hard was week 9 code review assignment? A) Easy B) Moderate C) Challenging D) Unreasonable 2 How long did week 9 assignment take? A) Less than 2 hours


slide-1
SLIDE 1

1

More ¡Android ¡

slide-2
SLIDE 2

2

How ¡hard ¡was ¡week ¡9 ¡code ¡review ¡assignment? ¡

A) ¡Easy ¡ B) ¡Moderate ¡ C) ¡Challenging ¡ D) ¡Unreasonable ¡

slide-3
SLIDE 3

3

How ¡long ¡did ¡week ¡9 ¡assignment ¡take? ¡ ¡

A) ¡Less ¡than ¡2 ¡hours ¡ B) ¡2 ¡to ¡4 ¡hours ¡ C) ¡4 ¡to ¡6 ¡hours ¡ D) ¡6 ¡to ¡8 ¡hours ¡ E) ¡More ¡than ¡8 ¡hours ¡

slide-4
SLIDE 4

4

Unix ¡

wc ¡ ¡ ¡-­‑-­‑ ¡“word ¡count” ¡ grep ¡– ¡“search ¡files ¡for ¡parNcular ¡strings” ¡ find ¡– ¡“idenNfy ¡files ¡with ¡matching ¡names” ¡

slide-5
SLIDE 5

5

TesNng ¡

Two ¡kinds ¡of ¡tests ¡for ¡Android ¡Projects: ¡

Normal ¡non-­‑UI ¡tests ¡(‘test’ ¡directory) ¡

Just ¡use ¡Junit ¡as ¡normal ¡

User ¡Interface ¡tests ¡(‘androidTest’ ¡directory) ¡

Use ¡Espresso ¡

slide-6
SLIDE 6

6

Which ¡is ¡not ¡an ¡Android ¡logging ¡level ¡

A) ¡ERROR ¡ B) ¡DEBUG ¡ C) ¡WTF ¡ D) ¡VERBOSE ¡ E) ¡All ¡of ¡the ¡above ¡are ¡valid ¡

slide-7
SLIDE 7

7

Logging ¡

Dump ¡messages ¡to ¡the ¡log; ¡see ¡with ¡Android ¡Monitor ¡ Log ¡messages ¡have: ¡

Priority ¡(ERROR, ¡WARN, ¡INFO, ¡DEBUG, ¡VERBOSE) ¡ Tag ¡ Message ¡

Usage: ¡ ¡(use ¡logd ¡shortcut) ¡

private final static String TAG = ClassName.class.getSimpleName();
 Log.d(TAG, “functionName: your message here");


slide-8
SLIDE 8

8

What ¡is ¡going ¡to ¡happen? ¡

A) ¡Success ¡ B) ¡Fail ¡– ¡Networking ¡on ¡main ¡thread ¡excepNon ¡ C) ¡Fail ¡– ¡Didn’t ¡iniNalize ¡networking ¡library ¡ D) ¡Fail ¡– ¡Don’t ¡have ¡permission ¡to ¡access ¡network ¡ E) ¡Fail ¡– ¡Can’t ¡translate ¡URL ¡to ¡IP ¡address ¡

slide-9
SLIDE 9

9

Android ¡Permission ¡Model ¡

Users ¡don’t ¡want ¡apps ¡to ¡violate ¡their ¡privacy ¡ Users ¡grant ¡apps ¡permission ¡to ¡do ¡things ¡

Access ¡the ¡network, ¡camera, ¡calendar, ¡phone ¡book, ¡etc. ¡ Historically, ¡these ¡have ¡been ¡granted ¡at ¡install ¡Rme ¡ All ¡or ¡nothing ¡model ¡

StarNng ¡in ¡Marshmallow, ¡incremental ¡permission ¡model ¡

Request ¡“mandatory” ¡permissions ¡at ¡install ¡Rme ¡ Request ¡other ¡permissions ¡as ¡needed ¡(for ¡clarity) ¡ Allow ¡users ¡to ¡revoke ¡permissions ¡

App ¡must ¡check ¡permissions ¡before ¡doing ¡controlled ¡things. ¡

slide-10
SLIDE 10

10

Threads ¡

When ¡you ¡write ¡code, ¡you ¡tell ¡the ¡machine ¡what ¡to ¡do ¡

One ¡thing ¡at ¡a ¡Rme. ¡

Hard/bad ¡to ¡interleave ¡mulNple ¡things ¡ ¡

E.g., ¡a ¡user ¡interface ¡with ¡long ¡latency ¡tasks ¡

slide-11
SLIDE 11

11

Threads, ¡cont. ¡

Computer ¡programs ¡are ¡made ¡up ¡of ¡threads ¡ Each ¡thread: ¡

Performs ¡a ¡series ¡of ¡task ¡ In ¡the ¡order ¡specified ¡by ¡the ¡code ¡ One ¡at ¡a ¡Rme ¡

Hard/bad ¡to ¡interleave ¡mulNple ¡things ¡on ¡a ¡single ¡thread ¡

E.g., ¡a ¡user ¡interface ¡with ¡long ¡latency ¡tasks ¡

SoluNon: ¡use ¡mulNple ¡threads; ¡dedicate ¡a ¡thread ¡to ¡the ¡UI ¡

So ¡it ¡is ¡always ¡responsive ¡ Do ¡slow ¡stuff ¡on ¡other ¡threads ¡ Have ¡to ¡handle ¡communicaRon/synch ¡between ¡threads ¡