Android осень 2013 лекция 1

  • View
    392

  • Download
    4

Embed Size (px)

DESCRIPTION

 

Transcript

  • 1. Android 1
  • 2. Agenda Android? Android GUI Activity 2
  • 3. Android? - Open Handset Aliance Google 3
  • 4. 4
  • 5. - 5
  • 6. - Profit! 6
  • 7. Android Source code 7
  • 8. UI main thread ANR Handler & Looper Java Threads Runnable AsyncTasks 8
  • 9. .APK (Android Package) Classes.dex Manifest Resources 9
  • 10. AndroidManifest.xml Xml Permissions 10
  • 11. Activity Service Content Provider Broadcast Receiver 11
  • 12. Activity activity 12
  • 13. Service remote Application layers 13
  • 14. Content Provider (, , .) 14
  • 15. Broadcast Receiver 15
  • 16. Android GUI MVC 16
  • 17. Activity Life Cycle Tasks & Back Stack Manifest Save instance state Intents 17
  • 18. Activity Life Cycle OnCreate(Bundle saveInstanceState) ( ) activity OnResume() activity OnPause() activity onResume() ! OnStop() , activity onDestroy() activity 18
  • 19. Tasks & Back Stack activity activity activity Task activities, activity , onStop() back activity , activity onResume() Activities ! 19
  • 20. Tasks & Back Stack Task activities background activities , activity 20
  • 21. Activity in Manifest 21
  • 22. Saving activity state 22
  • 23. Saving instance state Home, activity, activity , () activity back stack onSaveInstanceState(Bundle outState) activity !( Back ) onStop() ! 23
  • 24. Intents , , activity, service : , (com.example.project.app.FreneticActivity) Action , , (Receivers) actions Data URI, action Category , , intent(CATEGORY_LAUNCHER) Extras Key-value pairs 24
  • 25. Intents (Explicit) : ( component name) (Implicit) : ( ) 25
  • 26. Intent Filters Intent , android : Action test Category test Data test Intent 26
  • 27. xml layouts android 27
  • 28. 28
  • 29. LinearLayout 29
  • 30. Gravity android:gravity android:layout_gravity 30
  • 31. Layout Weight android:layout_weight , 0 space assign to child = (child individual weight) / (sum of weight of every child in Linear Layout) = 0, , , weight linearLayout! 31
  • 32. Multiple screens , , . Android 32
  • 33. Multiple screens ( ) Screen density(dpi - ) low, medium, high, extra high (, ) ( ) Density-independent pixel(dp) 1 dp = 1px 160dpi medium px = dp * (dpi / 160) 240dpi 1dp=1.5px dp, px 33
  • 34. Multiple screens Density independence 34
  • 35. Multiple screens dp layout (small, normal, large, xlarge) http://developer.android.com/guide/practices/screens_support .html http://developer.android.com/guide/topics/resources/providin g-resources.html 35
  • 36. !