Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. public class Pododroid extends Activity{
  2.  
  3. .....
  4.  
  5. private PasoService mServicio;
  6.  
  7. private ServiceConnection mConection = new ServiceConnection();
  8.  
  9. public class ServiceConnection{
  10.  
  11. public void onServiceConnected(ComponentName className, IBinder service) {
  12.     mServicio = ((PasoService.PasoBinder)service).getService();
  13.  
  14.     mServicio.registerCallback(mCallback);
  15.     mServicio.actualizaPreferencias();             
  16.     }
  17.  
  18.     public void onServiceDisconnected(ComponentName className) {
  19.         mServicio = null;
  20.     }
  21.                        
  22. }
  23.  
  24. // AQUI ME SALE ERROR
  25.  
  26. // Enlaza la clase con el servicio(creando el servicio si existe la conexion)
  27. private void bindPasoService() {
  28.     Log.i(TAG, "[SERVICE] Bind");
  29.     bindService(new Intent(Pododroid.this, PasoService.class),
  30.                    mConection,
  31.                    Context.BIND_AUTO_CREATE + Context.BIND_DEBUG_UNBIND);
  32.      }
  33.  
  34. // Desconecta la clase con el servicio
  35. private void unbindPasoService() {
  36.     Log.i(TAG, "[SERVICE] Unbind");
  37.     unbindService(mConection);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement