3

Can I have one itemStateChanged method to monitor changes triggered by user for many Displayable objects in a MIDlet (e.g. for a form and a list), using if clauses to decide what was changed, or do I have to create a different method for each Displayable I want to monitor?

gnat
  • 6,213
  • 108
  • 53
  • 73
nikos
  • 2,893
  • 11
  • 30
  • 39

1 Answers1

2

If you are talking about instantiating several Form and one ItemStateListener and calling Form.setItemStateListener() several times with the same parameter, then yes, you can do that.

Theoretically, you should write thread-safe code in your implementation of itemStateChanged but given the way existing java-me implementations handle events and the very small number of MIDP-compliant phones using 2 physical screens, I don't think it's very important in practice.

michael aubert
  • 6,836
  • 1
  • 16
  • 32