Please help. I have a service with code:

public class RequestService extends Service {

    private NotificationManager nm;
    private Timer timer;
    private static final long POLL_INTERVAL = 15000;
    private static final long DELAY_EXECUTION = 500;

    private static final String TAG =
RequestService.class.getSimpleName();

        private TimerTask task = new TimerTask(){
        @Override
        public void run()
        {
                refreshRequests();
        }
    };

    @Override
    public void onCreate() {
        this.timer = new Timer();
        this.timer.schedule(this.task, RequestService.DELAY_EXECUTION,
RequestService.POLL_INTERVAL);
    }

    private void refreshRequests()
    {
        Prefs pref = new Prefs(this.getBaseContext());
        String response = this.getInputSream(pref.getServer().concat("?
action=request"));
        try {
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();
            XMLReader xr = sp.getXMLReader();
            RequestHandler handler = new RequestHandler
(this.getBaseContext(), null);
            xr.setContentHandler(handler);
            xr.parse(new InputSource(new StringReader(response)));
            List<Request> requests = handler.getRequests();
            ....
        } catch (Exception e) {
            Log.e(TAG, " " + TAG + " ERROR - " + e);
        }
    }

}

How i can return  "List<Request> requests"  to activity for update UI.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to