public class SocketService extends Service{
int PORT = 9999; // @Override
public IBinder onBind(Intent arg0) {
PORT = 3256;
com.Logi("extra:"+arg0.getIntExtra("extra",0));
com.Logi("SocketService.onBind,PORT:"+PORT);
return new Binder();
}
public boolean StartSocketServ(ContextWrapper container,int port){
Intent intent = new Intent("SocketService");
intent.putExtra("extra",5);
PORT = port;
                return container.bindService(intent,servCon,Service.BIND_AUTO_CREATE);
}
}
SocketService实例化类一个静态变量 static ss;
在Activity里调用
ss.StartScoketServ(this,8888);服务器调用是成功的,onBind里检测的数值也都正确,但是PORT值仍然是port设置的值,可以肯定,onBind是后调用的。实际上如果不设置PORT=port,PORT将保持初始值,onBind里的设置是无效的!!!