コード例 #1
0
 @Override
 protected void onResume() {
   super.onResume();
   if (USocket.estaDisponibleWifi(this)
       && !USocket.estaCorriendoMiServicio(Servicio.class, this)) {
     startService(new Intent(this, Servicio.class));
   }
 }
コード例 #2
0
 public void registrar(View view) {
   EditText matricula = (EditText) findViewById(R.id.eMatricula);
   EditText ci = (EditText) findViewById(R.id.eCi);
   if (USocket.validarSocket(this)) {
     if (matricula.getText().length() > 0 && ci.getText().length() > 0) {
       Estatica.me.setMatricula(matricula.getText().toString().trim());
       Estatica.me.setCi(ci.getText().toString().trim());
       Estatica.me.setTipo(Constantes.tipoMedico);
       Estatica.interprete.setContext(this);
       Estatica.interprete.interpretar(Instruccion.registrarPaciente);
     } else {
       Toast.makeText(view.getContext(), R.string.llenarTodosCampos, Toast.LENGTH_LONG).show();
     }
   } else {
     Toast.makeText(view.getContext(), R.string.verificarConexion, Toast.LENGTH_LONG).show();
   }
 }