摘要: 1.新建工程PlayService2.设置main.xml<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent&q 阅读全文
posted @ 2012-06-08 11:14 罗小姿 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 一、认识Service它是在后台运行,不可交互的一个东西,不能自己运行,需要通过某一个Activity或者其它的Context对象来调用,如Context.startService()和Context.bindService()二种方式启动Service。需要说明的是:如果在Service的onCreate()或者onStart()方法里面做一些很耗时的动作,最好是启动一个新线程来运行这个Service。因为如果Service是运行在主线程中,会影响程序的UI操作或者阻塞主线程中的其它事情。应用场景:播放多媒体的时候用户启动了其它Activity,这个时候程序要在后台继续播放;检测SD卡上文件 阅读全文
posted @ 2012-06-07 17:22 罗小姿 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 编写的mail.xml文件:<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/frame" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layo 阅读全文
posted @ 2012-06-04 10:36 罗小姿 阅读(296) 评论(0) 推荐(0) 编辑
摘要: ContentObserver——内容观察者,目的是观察(捕捉)特定Uri引起的数据库的变化,继而做一些相应的处理,它类似于 数据库技术中的触发器(Trigger),当ContentObserver所观察的Uri发生变化时,便会触发它。触发器分为表触发器、行触发器, 相应地ContentObserver也分为“表“ContentObserver、“行”ContentObserver,当然这是与它所监听的Uri MIME Type有关的。 熟悉Content Provider(内容提供者)的应该知道,我们可以通过UriMatcher类注册不同类型的Uri,我们可以通过这些不同的 Uri来查询不. 阅读全文
posted @ 2012-06-02 17:04 罗小姿 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 在SDK中 Parcelable类的概述是这样的:Interface for classes whose instances can be written to and restored from aParcel. Classes implementing the Parcelable interface must also have a static field calledCREATOR, which is an object implementing theParcelable.Creatorinterface.这个接口的实例是通过Parcel进行存储的,在使用Parcelable的时候 阅读全文
posted @ 2012-06-02 13:57 罗小姿 阅读(267) 评论(0) 推荐(0) 编辑