Android Server类
2010-10-19 20:17:26 来源:WEB开发网在 LOG 中显示进程
view plaincopy to clipboardprint?
1. package my.android.AppServer;
2.
3. import android.app.Activity;
4. import android.content.Intent;
5. import android.os.Bundle;
6. import android.view.View;
7. import android.widget.Button;
8.
9. public class AppServer extends Activity implements android.view.View.OnClickListener {
10.
11. private Button mButton1, mButton2;
12.
13. /** Called when the activity is first created. */
14. @Override
15. public void onCreate(Bundle savedInstanceState) {
16. super.onCreate(savedInstanceState);
17. setContentView(R.layout.main);
18.
19. mButton1 = (Button) findViewById(R.id.button1_id);
20. mButton1.setOnClickListener(this);
21.
22. mButton2 = (Button) findViewById(R.id.button2_id);
23. mButton2.setOnClickListener(this);
24. }
25.
26. public void onClick(View v) {
27. // TODO Auto-generated method stub
28.
29. switch (v.getId()) {
30. case R.id.button1_id:
31. Intent i = new Intent(this, mService.class);
32. i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
33. startService(i);
34. break;
35. case R.id.button2_id:
36. Intent i2 = new Intent(this, mService.class);
37. stopService(i2);
38. break;
39. default:
40. break;
41. }
42. }
43. }
package my.android.AppServer; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class AppServer extends Activity implements android.view.View.OnClickListener { private Button mButton1, mButton2; /**
- ››Android 当修改一些代码时,使用什么编译命令可以最...
- ››Android 如何添加一个apk使模拟器和真机都编译进去...
- ››Android 修改Camera拍照的默认保存路径
- ››Android 如何修改默认输入法
- ››android开发中finish()和System.exit(0)的区别
- ››Android手势识别简单封装类
- ››android中查看项目数字证书的两种方法
- ››Android中获取IMEI码的办法
- ››android 相机报错 setParameters failed
- ››Android重启运用程序的代码
- ››Android为ListView的Item设置不同的布局
- ››android bitmap与base64字符串的互相转换
更多精彩
赞助商链接