Android Server类
2010-10-19 20:17:26 来源:WEB开发网view plaincopy to clipboardprint?
1. package my.android.AppServer;
2.
3. import android.app.Service;
4. import android.content.Intent;
5. import android.os.Handler;
6. import android.os.IBinder;
7. import android.util.Log;
8.
9. public class mService extends Service {
10.
11. private Handler objHandler = new Handler();
12. private int intCounter = 0;
13.
14. private Runnable mTasks = new Runnable() {
15. public void run() {
16. intCounter++;
17. Log.i("hippo", "counter:" + Integer.toString(intCounter));
18. objHandler.postDelayed(mTasks, 1000);
19. }
20. };
21.
22. @Override
23. public void onStart(Intent intent, int startId) {
24. objHandler.postDelayed(mTasks, 1000);
25. super.onStart(intent, startId);
26. }
27.
28. @Override
29. public void onCreate() {
30. super.onCreate();
31. }
32.
33. @Override
34. public IBinder onBind(Intent intent) {
35. // TODO Auto-generated method stub
更多精彩
赞助商链接