• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic menu generation

 
Jorma Ikonen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm just wondering that am I doing/trying to do something what currently is not possible to do by J2ME compatible devices (phones).
Brief:
1. Phone/application makes a network request of server-folders from the main server.
2. By using information of return value, the phone/application regenerates menu.
3. Depending on user selection, the phone/application makes a request of servers under selected folder.
4. By using information of return value, the phone/application regenerates once again menu based on this reguest.
5. Depending on user selection, the phone/application makes a request of supported commands of selected server under previously selected folder.
6. By using information of return value, the phone/application regenerates once again menu based on supported commands.
7. Selected command can be sent to selected server.
The data structure of this is mainly based on use of Hashtables (hashtables inside hashtable and so on). Also used phone's/application's Command-objects are stored into these hashtables that regenerating of phone/application menus are possible to do later on easily and without new network request of previously requested thing (e.g user pushes Backward-button).
First this dynamic menu (re)generation sound very good idea and it actually worked "quite" well in Nokia's emulator. Then I tested it on Sun's similar and it jamed immediatelly while requesting data on network. I got warning about using network connection inside ActionCommand (network connections should do in other thread!?!), but somehow I felt this warning indicates of something more (serious bug in J2ME implemetation?). Also Nokia's emulator started to confuse after a couple of forward - backward pushes even network connection wasn't needed anymore (data structure was created on previous requests).
I'm quite beginner in Java programing and especially J2ME knowledge is based on a week testing period. So, I'm intteresting in your professional experience of my possibility to succeed. Does the thread help, or should I gave up this way of coding/menu generation? In j2SE I could use JTree+serialization or even XML-parser, but this Micro edition starts to shit me quite much...
Your opinions are highly welcome.
br,
Jorma
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In short, yes, you do need to put any network operation in a separate thread. Otherwise, it blocks the main UI thread. This behavior is discussed in the MIDP specification.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic