1 / 29

网络、多媒体、传感器、提醒

网络、多媒体、传感器、提醒. 内容. 网络 多媒体 传感器 提醒 ……. 网络. java.net — Socket, URL org.apache — HttpRequest , HttpResponse android.net — URI, AndroidHttpClient , AudioStream 需要网络访问的权限 <uses- permission android:name = “ android.permission.INTERNET ”/ >. HttpURLConnection. 比 Sockets 高层

moses-cohen
Download Presentation

网络、多媒体、传感器、提醒

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 网络、多媒体、传感器、提醒

  2. 内容 • 网络 • 多媒体 • 传感器 • 提醒 • ……

  3. 网络 • java.net — Socket, URL • org.apache—HttpRequest, HttpResponse • android.net — URI, AndroidHttpClient, AudioStream • 需要网络访问的权限 <uses-permission android:name= “android.permission.INTERNET”/>

  4. HttpURLConnection • 比Sockets高层 • 不如HttpAndroidClient灵活 http://developer.android.com/reference/java/net/HttpURLConnection.html

  5. AndroidHttpClient • Apache的DefaultHttpClient的一种实现 • 把HTTP分解成Request和Response对象 • Google已经不再维护,不建议使用

  6. 多媒体 • 画图 • 动画 • 视频、音频 • 手势

  7. 画图 • ImageView • 简单图形,没有或很少更新 • Canvas • 复杂图形,经常更新

  8. ImageView • Drawable • BitmapDrawable • ShapeDrawable • ColorDrawable • …… • 可以通过XML或者编程设定 http://developer.android.com/intl/zh-cn/guide/topics/graphics/2d-graphics.html#drawables

  9. Canvas • 作为画布的一个Bitmap • 支持多种画图函数 • drawText() • drawPoints() • drawColor() • …… http://developer.android.com/intl/zh-cn/guide/topics/graphics/2d-graphics.html#draw-with-canvas

  10. 动画 • 视图动画 • 属性动画

  11. 视图动画 • 改变视图在一段时间内的属性 • 大小 • 位置 • 透明度 • 旋转 http://developer.android.com/intl/zh-cn/guide/topics/graphics/view-animation.html

  12. 属性动画 • 改变一个对象某段时间内的属性 • ValueAnimator – 计时引擎 • TimeInterpolator – 插值方式 • AnimatorUpdateListener – 在动画的每一帧调用 • TypeEvaluator –计算某一个时间点的属性值 http://developer.android.com/intl/zh-cn/guide/topics/graphics/prop-animation.html

  13. 视频、音频 • AudioManager & SoundPool • RingtoneManager & Ringtone • MediaPlayer • MediaRecorder • Camera

  14. AudioManager • 管理音量、系统声音效果、响铃模式等 • Context.getSystemService(Context.AUDIO_SERVICE) • SoundPool • 表示一组音频样例(流) • 可以对多组音频进行混合、播放 • RingtoneManager和Ringtone • 管理电话、通知、闹钟等铃声

  15. MediaPlayer • 播放音频、视频 • 程序可以控制播放 http://developer.android.com/guide/topics/media/mediaplayer.html

  16. MediaRecorder • 用于录制音频和视频 http://developer.android.com/intl/zh-cn/reference/android/media/MediaRecorder.html

  17. Camera • 相机服务的客户端,管理实际的相机硬件 • 管理成像设置 • 开始/停止预览 • 拍照

  18. Camera • 权限 <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name= "android.hardware.camera.autofocus" /> http://developer.android.com/intl/zh-cn/guide/topics/media/camera.html

  19. 多点触摸 • MotionEvent • 处理多点触摸 • 手势

  20. MotionEvent • 表示输入设备的一次移动 • 触控笔 • 轨迹球 • 鼠标 • 手指 • View.onTouchEvent(MotionEvent event) http://developer.android.com/intl/zh-cn/training/gestures/multi.html

  21. GestureDetector • 识别一般的手势 • 内置的手势包括单击、双击、滑动等 • 可以用GestureBuilder自定义手势 http://developer.android.com/intl/zh-cn/training/gestures/index.html

  22. 提醒 • AlarmManager • getSystemService(Context.ALARM_SERVICE) • 可以设置各种提醒 http://developer.android.com/training/scheduling/alarms.html

  23. 传感器 • SensorManager & Sensor • SensorEvent & SensorEventListener

  24. 传感器 • 衡量物理环境的硬件设备 • 动作 • 位置 • 环境信息 • SensorManager • getSystemService(Context.SENSOR_SERVICE) • SensorManager.getDefaultSensor(int type)

  25. 传感器事件 • 通过回调函数处理 • SensorEventListener • 在传感器的值发生变化时调用 http://developer.android.com/intl/zh-cn/guide/topics/sensors/sensors_overview.html

  26. 位置 • 位置 • 表示地球上的一个位置 • 经纬度、精确度、时间戳等 • GPS、基站、Wifi • android.permission.ACCESS_COARSE_LOCATION • android.permission.ACCESS_FINE_LOCATION • getSystemService(Context.LOCATION_SERVICE) • LocationListener http://developer.android.com/intl/zh-cn/guide/topics/location/index.html#location

  27. 地图 • 一块区域的可视表示 • Google Maps Android API http://developer.android.com/intl/zh-cn/guide/topics/location/index.html#maps

  28. 其它…… • Widget • Style/Theme • 游戏:OpenGL ES • 计算:RenderScript • 蓝牙、NFC、USB…… • 输入法…… • Web app • ……

  29. 学无止境

More Related