From c45887f26e131581027835cd0708d23b4eddd075 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 9 Mar 2011 23:01:20 +0100 Subject: [PATCH] I3: Tarea asincrona en el servicio --- src/com/onirica/carrousel/Results.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/com/onirica/carrousel/Results.java b/src/com/onirica/carrousel/Results.java index c4be4d1..f5518a2 100644 --- a/src/com/onirica/carrousel/Results.java +++ b/src/com/onirica/carrousel/Results.java @@ -1,5 +1,8 @@ package com.onirica.carrousel; +import java.util.Timer; +import java.util.TimerTask; + import android.app.Service; import android.content.Intent; import android.os.IBinder; @@ -11,5 +14,18 @@ public class Results extends Service { // TODO Auto-generated method stub return null; } + @Override + public void onCreate() { + pollingTask task = new pollingTask(); + Timer timer = new Timer(true); + timer.scheduleAtFixedRate(task, 0, 60000); + } + + private class pollingTask extends TimerTask { + @Override + public void run() { + // Aqui descargaremos los resultados + } + } }