Alex Rivera | Logout

Creating a custom event listener on an Android app

Asked 2010-06-06T05:49:19.410
42

I need to set up a simple event listener to refresh a ListView once in a while. The problem is I don't know how could I generate an event.

I know that for events like key or button pressing I just need to implement the Handler. But in this specific case I actually need to generate the event, which will be fired every time another running thread of my app wakes up and refreshes its list of news from an RSS feed.

I've done everything, but got stuck in here. Can I get some more info on how to implement this?

Edit
Report

1 Answer

3

It sounds like you need a Handler - (look-up android.os.Handler for details).

The sendMessageDelayed method will allow you to schedule when the message is sent to your handler.

A quick search pulled up a full example that should get you started: https://web.archive.org/web/20200810154212/http://www.tutorialforandroid.com/2009/01/using-handler-in-android.html

answered 2010-06-07T11:21:27.403

Your Answer