标签:os ar java sp on art 问题 cti log
============问题描述============
class onStartServiceClickListener implements OnClickListener { public void onClick(View v) { IP = editTextIP.getText().toString(); Port = Integer.parseInt(editTextPort.getText().toString()); Log.v("IP", IP); Log.v("Port", editTextPort.getText().toString()); Intent intent=new Intent(); intent.putExtra("IP", IP); intent.putExtra("Port", Port); intent.setClass(MainActivity.this,SendGPSService.class); startService(intent); } } Service中 public void onCreate() { super.onCreate(); // new ClientThread("10.13.33.136", 5000); //线程正常执行 } public int onStartCommond(Intent intent, int flags, int startId) { // 不能执行,换成new ClientThread("10.13.33.136", 5000); 也不行 new ClientThread(intent.getStringExtra("IP"), intent.getIntExtra("Port", 5000)); Log.v("Service IP", intent.getStringExtra("IP"));// 因为Logcat中不打印这些信息,所以判断onStartCommond没有调用 Log.v("Service Port", intent.getIntExtra("Port", 5000) + ""); Log.v("Service IP", "onStartCommond!"); return super.onStartCommand(intent, flags, startId); }
============解决方案1============
public int onStartCommand(Intent intent, int flags, int startId)
标签:os ar java sp on art 问题 cti log
原文地址:http://www.cnblogs.com/liangxieliang56/p/4033933.html