G scrolling text re drawing a window comp 4521

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fy what kind of events they are interested in, i.e. specify the event sources COMP 4521 (Muppala) Android UI Overview 16 Registering Listeners Listener 1 Listener 2 Source (eg. Button) Listener 3 REGISTER (‘please inform me’) Listener 4 COMP 4521 (Muppala) Android UI Overview 17 Event Driven Programming •  There’s no top- down flow of control, i.e. no ‘Main’- program defining the sequen7al flow •  Code fragments are associated with events and invoked when events occur •  Order of execu7on is decoupled •  Don’t have to deal with order of events –  This is especially helpful, when the order is unknown ! COMP 4521 (Muppala) Android UI Overview 18 Where’s the ‘MAIN’ ? •  The Opera7ng System manages an event- queue •  The event- queue contains informa7on about event- sources and their registered listeners •  As events occur, they are placed in the queue to be dispatched by the event - loop •  The OS loops through the event- queue, passing the command to the specified listeners •  The MAIN – control is passed to the OS, the program is in idle state un7l ac7vated by events •  The MAIN is replaced by the event- loop COMP 4521 (Muppa...
View Full Document

This document was uploaded on 03/12/2014.

Ask a homework question - tutors are online