WEB开发网
开发学院手机开发Android 开发 创建android的Service 阅读

创建android的Service

 2010-08-22 04:46:00 来源:WEB开发网   
核心提示:bindbt.setOnClickListener(listener);unbindbt.setOnClickListener(listener);*/}}SampleService.javapackage com.android;import android.app.Activity;import android.a

bindbt.setOnClickListener(listener);

unbindbt.setOnClickListener(listener);

*/

}

}

SampleService.java

package com.android;

import android.app.Activity;

import android.app.Service;

import android.content.Intent;

import android.os.IBinder;

import android.util.Log;

import android.os.Bundle;

public class SampleService extends Service{

@Override

public void onCreate() {

// TODO Auto-generated method stub

super.onCreate();

Log.d(TAG,"OnCreate");

}

@Override

public void onDestroy() {

// TODO Auto-generated method stub

super.onDestroy();

Log.d(TAG,"OnDestroy");

}

@Override

public void onRebind(Intent intent) {

// TODO Auto-generated method stub

super.onRebind(intent);

Log.d(TAG,"OnRebind");

}

@Override

public void onStart(Intent intent, int startId) {

// TODO Auto-generated method stub

super.onStart(intent, startId);

Log.d(TAG,"OnStart");

}

@Override

public boolean onUnbind(Intent intent) {

// TODO Auto-generated method stub

Log.d(TAG, "OnUnBind");

return super.onUnbind(intent);

}

final String TAG="Service";

@Override

public IBinder onBind(Intent intent) {

// TODO Auto-generated method stub

Log.d(TAG,"OnBind");

return null;

}

}

上一页  1 2 3 

Tags:创建 android Service

编辑录入:coldstar [复制链接] [打 印]
赞助商链接