android_service

所属分类:android开发
开发工具:Java
文件大小:942KB
下载次数:56
上传日期:2012-08-20 13:02:36
上 传 者tornadomeet
说明:  本次实验主要是学习怎样在activity中启动一个service,启动的service的生命周期顺序是哪些,然后service通过广播机制向特定的activity传递数据,传送数据当然用的是intent,然后接收到该广播的activity读取intent中的数据,根据读取到的数据来更新activity的UI。   关于怎样通过service广播机制来更新activity的UI,可以阅读网上的这篇文章:http://www.pocketdigi.com/20110303/197.html   需要注意的是service类是继承的android框架中的Service类,程序中需要将写好的service在AndriodManiFest.xml中进行注册,注册方法和activity的注册类似。   本程序的activity中有2个按钮和1个TextView,2个按钮分别用来启动service和停止service,然后在activtiy和service的生命周期函数中各自在后台打印出相关语句,同时为了方便观察,程序也直接将相关语句输出到了textview中。
(This experiment to learn how to start a service in the activity start service order of the life cycle of which, and service through the broadcast mechanism to transfer data to a specific activity, transmission of data, of course with the An intent, and then receives the broadcast activity to read the intent of the data, according to the read data to update the activity of the UI. This article can be read online on how to update the activity through the service broadcast mechanism UI: http://www.pocketdigi.com/20110303/197.html need to pay attention to in the service class in the service class is inherited android framework The program will need to write the service in AndriodManiFest.xml register, similar to the method of registration and the registration of the activity. The activity of this program have two buttons and a TextView, 2 buttons are used to start the service and stop service, and then activtiy and service life cycle function in the background print out statements at the s)

文件列表:
Android开发历程_13(Service的使用).pdf (298947, 2012-08-20)
service (0, 2012-08-20)
service\.classpath (364, 2012-08-20)
service\.project (843, 2012-08-20)
service\.settings (0, 2012-08-20)
service\.settings\org.eclipse.jdt.core.prefs (177, 2012-08-20)
service\AndroidManifest.xml (853, 2012-08-20)
service\assets (0, 2012-08-20)
service\bin (0, 2012-08-20)
service\bin\AndroidManifest.xml (853, 2012-08-20)
service\bin\classes (0, 2012-08-20)
service\bin\classes\com (0, 2012-08-20)
service\bin\classes\com\example (0, 2012-08-20)
service\bin\classes\com\example\service (0, 2012-08-20)
service\bin\classes\com\example\service\BuildConfig.class (347, 2012-08-20)
service\bin\classes\com\example\service\FisrtService.class (1806, 2012-08-20)
service\bin\classes\com\example\service\MainActivity$EndOnClickListener.class (1214, 2012-08-20)
service\bin\classes\com\example\service\MainActivity$MyReceiver.class (1347, 2012-08-20)
service\bin\classes\com\example\service\MainActivity$StartOnClickListener.class (1253, 2012-08-20)
service\bin\classes\com\example\service\MainActivity.class (2656, 2012-08-20)
service\bin\classes\com\example\service\R$attr.class (343, 2012-08-20)
service\bin\classes\com\example\service\R$drawable.class (450, 2012-08-20)
service\bin\classes\com\example\service\R$id.class (478, 2012-08-20)
service\bin\classes\com\example\service\R$layout.class (406, 2012-08-20)
service\bin\classes\com\example\service\R$menu.class (400, 2012-08-20)
service\bin\classes\com\example\service\R$string.class (574, 2012-08-20)
service\bin\classes\com\example\service\R$style.class (398, 2012-08-20)
service\bin\classes\com\example\service\R.class (634, 2012-08-20)
service\bin\classes.dex (321896, 2012-08-20)
service\bin\jarlist.cache (119, 2012-08-20)
service\bin\res (0, 2012-08-20)
service\bin\res\drawable-hdpi (0, 2012-08-20)
service\bin\res\drawable-hdpi\ic_action_search.png (409, 2012-08-20)
service\bin\res\drawable-hdpi\ic_launcher.png (4129, 2012-08-20)
service\bin\res\drawable-ldpi (0, 2012-08-20)
service\bin\res\drawable-ldpi\ic_launcher.png (1756, 2012-08-20)
service\bin\res\drawable-mdpi (0, 2012-08-20)
service\bin\res\drawable-mdpi\ic_action_search.png (311, 2012-08-20)
service\bin\res\drawable-mdpi\ic_launcher.png (2654, 2012-08-20)
service\bin\res\drawable-xhdpi (0, 2012-08-20)
... ...

近期下载者

相关文件


收藏者