实例示范如何使用 Android Services
2010-03-03 15:48:00 来源:WEB开发网核心提示:<activity android:name=”.ServicesDemo” android:label=”@string/app_name”> <intent-filter> <action android:name=”android.intent.action.MAIN” /&
<activity android:name=”.ServicesDemo”
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:enabled=”true” android:name=”.MyService” />
</application>
<uses-sdk android:minSdkVersion=”3″ />
</manifest>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
<service android:enabled=”true” android:name=”.MyService” />
</application>
<uses-sdk android:minSdkVersion=”3″ />
</manifest>
<?xml version=”1.0″ encoding=”utf-8″?>
<manifest
xmlns:android=”http://schemas.android.com/apk/res/android”
package=”com.example” android:versionCode=”1″ android:versionName=”1.0″>
<application android:icon=”@drawable/icon”
android:label=”@string/app_name”>
<activity
android:name=”.ServicesDemo” 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:enabled=”true” android:name=”.MyService” />
</application>
<uses-sdk android:minSdkVersion=”3″
/>
</manifest>
定义Activity,ServicesDemo.java
Java代码
package com.example;
import android.app.Activity;
[]
更多精彩
赞助商链接