如何使用eclipse创建service(教程)
来源:互联网 发布:悟空传中的网络元素 编辑:程序博客网 时间:2024/05/17 03:14
使用android studio创建service的时候,通过new就可以创建(并且会帮你在AndroidManifest中注册),但是当你使用eclipse的时候,你会发现其并不像 android studio。
解决办法:
首先你得创建一个类然后让其继承自service,需要导入的包是: import android.app.Service;
import android.os.IBinder;
然后再androidmanifest中的注册:
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.demo" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <service android:name=".DS"//这里写的是类名 android:enabled="true" android:exported="true" ></service> </application></manifest>
这样就可以了,希望对你有多帮助
0 0
- 如何使用eclipse创建service(教程)
- 如何使用eclipse创建项目
- eclipse创建service服务
- [教程]如何使用V7包中ActionBar(Eclipse版)
- [教程]如何使用V7包中ActionBar(Eclipse版)
- [教程]如何使用V7包中ActionBar(Eclipse版)
- 使用Eclipse + MyEclipse开发Web Service的示例!(录像教程)
- 使用 Apache Axis2 和 Eclipse 创建 Java Web Service(二)
- RESTful Web Service(二):使用eclipse创建restful webservice 工程
- 使用 Apache Axis2 和 Eclipse 创建 Java Web Service
- 如何创建service
- 如何创建一个Service
- 如何使用eclipse创建java项目
- Javaweb---如何使用eclipse创建Javaweb项目
- 如何创建和使用Web Service代理类
- 如何创建和使用Web Service代理类
- eclipse创建web service全过程
- eclipse中创建web service
- stream的job的产生
- Ubuntu 16.04 更新源失败问题
- tupian
- 设置QT的按钮,鼠标移上去变手型
- 在Android中,关于如何使状态栏透明化的问题
- 如何使用eclipse创建service(教程)
- 用 KVM 搭建web集群实验笔记 - 安装Nginx 和配置Web服务
- RasGetSubEntryProperties
- 172. Factorial Trailing Zeroes*
- servlet学习笔记(二)
- 简单的用列子理解ajax同步异步
- 进程五种基本状态
- Codeforces gym 100685 E
- CSU-1804-有向无环图-拓扑排序+DP