Can anyone help me with implementing a blocking modal dialog in MIDP1.0?
Hi guys.. I'm posting because I dont know much about the way java ui runs with respect to threading.. Infact, I dont know how many threads a J2ME app would run to write hello world on the screen, or how I would pause them but maintain responsiveness.
I read this thread: SonyEricssonDevelopers
which gave me a few pointers.
I then wrote this code, that doesnt work:
public class QuestionForm extends Form implements CommandListener {
private static Object lock = new Object();
private String answer = null;
private String defaultAnswer = null;
public QuestionForm(String message, String answer1, String answer2) {
super("");
this.defaultAnswer = answer1;
this.append(new StringItem(message, ""));
this.addCommand(new Command(answer1, Command.BACK, 1));
this.addCommand(new Command(answer2, Command.BACK, 2));
this.setCommandListener(this);
public String ask(){
answer = null;
//static accessor for display
GoText.display.setCurrent(this);
synchronized(lock){
try{
while(answer == null)
wait();
}catch(Exception ex){
answer = defaultAnswer;
return answer;
public void commandAction(Command c, Displayable d) {
answer = c.getLabel();
synchronized(lock){
notifyAll();
}I want to be able to say:
//some code.. oh we need to ask the user a question
Question q = new Question("Really quit?", "yes", "no");
if(q.ask() == "yes")
//quit..And I want to block the execution of the current thread just like we are used to from e.g. windows message boxes.. I know there isnt any code in there to revert to the previous screen yet, i dont know if there is a way to do that easily? Does the Display class keep a history so I can just say hide() or showThePreviousScreenAgain()..
In the debug window of WTK, i can see (via debug println) that the code shows the question, gets to the wait() and bombs with an IllegalMonitorState ; i presume I'm not locking on the same thread that created the lock. I've tried locking on the display, on this (the ui hangs), on the main midlet class.. and none of them work as expected. Can anyone offer any pointers? There is an accessory discussion going on at CodeGuru
Cheers guys!
cjard
Edited by: cjard on Mar 4, 2008 12:37 AM
Hi guys.. I'm posting because I dont know much about the way java ui runs with respect to threading.. Infact, I dont know how many threads a J2ME app would run to write hello world on the screen, or how I would pause them but maintain responsiveness.
I read this thread: SonyEricssonDevelopers
which gave me a few pointers.
I then wrote this code, that doesnt work:
public class QuestionForm extends Form implements CommandListener {
private static Object lock = new Object();
private String answer = null;
private String defaultAnswer = null;
public QuestionForm(String message, String answer1, String answer2) {
super("");
this.defaultAnswer = answer1;
this.append(new StringItem(message, ""));
this.addCommand(new Command(answer1, Command.BACK, 1));
this.addCommand(new Command(answer2, Command.BACK, 2));
this.setCommandListener(this);
public String ask(){
answer = null;
//static accessor for display
GoText.display.setCurrent(this);
synchronized(lock){
try{
while(answer == null)
wait();
}catch(Exception ex){
answer = defaultAnswer;
return answer;
public void commandAction(Command c, Displayable d) {
answer = c.getLabel();
synchronized(lock){
notifyAll();
}I want to be able to say:
//some code.. oh we need to ask the user a question
Question q = new Question("Really quit?", "yes", "no");
if(q.ask() == "yes")
//quit..And I want to block the execution of the current thread just like we are used to from e.g. windows message boxes.. I know there isnt any code in there to revert to the previous screen yet, i dont know if there is a way to do that easily? Does the Display class keep a history so I can just say hide() or showThePreviousScreenAgain()..
In the debug window of WTK, i can see (via debug println) that the code shows the question, gets to the wait() and bombs with an IllegalMonitorState ; i presume I'm not locking on the same thread that created the lock. I've tried locking on the display, on this (the ui hangs), on the main midlet class.. and none of them work as expected. Can anyone offer any pointers? There is an accessory discussion going on at CodeGuru
Cheers guys!
cjard
Edited by: cjard on Mar 4, 2008 12:37 AM
Similar Messages
-
TS3694 error 21 can anyone help me with this?
Can anyone help me with an error message i get with my iphone, it say error 21 after trying to restore the phone though itunes.
These errors typically occur when security software interferes with the restore and update process. FollowTroubleshooting security software issues to resolve this issue. In rare cases, these errors may be a hardware issue. If the errors persist on another computer, the device may need service.
Also, check your hosts file to verify that it's not blocking iTunes from communicating with the update server. See iTunes: Advanced iTunes Store troubleshooting—follow steps under the heading Blocked by configuration (Mac OS X / Windows) > Rebuild network information > Mac OS X > The hosts file may also be blocking the iTunes Store. If you have software used to perform unauthorized modifications to the iOS device, uninstall this software prior to editing the hosts file to prevent that software from automatically modifying the hosts file again on restart. -
i have an iphone 3gs and everytime i try to restore it on itunes it just keeps saying an unknown erroe has occured (29) can anyone help me with this??
Hello Laura,
Thank you for posting in the Apple Support Communities. I found an article that has information about Error 29:
Error 20, 21, 23, 26, 28, 29, 34, 36, 37, 40
These errors typically occur when security software interferes with the restore and update process. Follow Troubleshooting security software issues to resolve this issue. In rare cases, these errors may be a hardware issue. If the errors persist on another computer, the device may need service.
Also, check your hosts file to verify that it's not blocking iTunes from communicating with the update server. See iTunes: Advanced iTunes Store troubleshooting—follow steps under the heading Blocked by configuration (Mac OS X / Windows) > Rebuild network information > Mac OS X > The hosts file may also be blocking the iTunes Store. If you have software used to perform unauthorized modifications to the iOS device, uninstall this software prior to editing the hosts file to prevent that software from automatically modifying the hosts file again on restart.
You can find the full article here:
iTunes: Specific update-and-restore error messages and advanced troubleshooting
http://support.apple.com/kb/ts3694
Best,
Sheila M. -
can anyone help me with Magicjack? after I purchased US number I am unable to log in on my Iphone, I keep getting an error "YOUR DEVICE IS NOT ON THIS ACCOUNT" I contacted MJ support but they are very much useless and dont know how to fix it!
There's a whole lot to read in your post, and frankly I have not read it all.
Having said that, this troubleshooting guide should help:
http://support.apple.com/kb/TS1538
In particular, pay attention to the mobile device support sections near the bottom, assuming you have already done the items above it. -
Can anyone help me with a problem i am having with my music on my iPhone 4S. I have put alot of Compilation CDs in my library on iTunes. I download these tracks onto my phone, everything is ok so far. Now, this is what is niggling me and I don.t know how to resolve it. This is my problem:
Have downloaded for example: Queen – Bohemium Rhapsody from a compilation album as well as a few complete Queen Album CDs into the iTunes library and then put them into playlists,
When I go onto my phone and select Queen on the MUSIC app using Songs tab at the bottom of the screen it will display all Queen songs and their resective Alum pics, that is all those not in a complilation album, .
If I know the song title I can select the songs tab and find the song that way,
I’ve tried fiddling with the settings in the iTunes app by going to ‘get info’ tab and trying to sort the problem out that way but am not having much luck.What I want the phone to do is show, for example all Queens songs including those in compilation albums. Can this be done, would be grateful for any ideas on how it can be done, that is if ic can be done, any ideas
Thanks for your helpTry assigning Queen as the Album Artist on the compilations in iTunes on your computer.
-
Hey, when I connect either my ipod or ipad to itunes I get the prompt 'itunes was unable to load data class information from sync services. Reconnect or try again later. Can anyone help me with syncing my devices?? Thanks in advance
I am having the same issue, anyone else ?
-
"It is formatted incorrectly, or is not a format that iBooks can open". Can anyone help me with this message of a book that I purchased on iBooks, read, highlighted in the book and now I can't open it anymore. Please help!!!
Mine does the same thing occasionally, is your phone jailbroken? Sometimes it will work if you delete the book and reinstall it or put your phone into airplane mode then turn it back off.
-
I can't find the 2G, 3G and LTE options after updating to iOS8.1, can anyone help me with this? I'm using iPhone5s
I have check on my service provider about the correct APN settings, but unfortunately doesnt work still..
-
I need to reinstall my operating system for 10.5 after seeing a file folder and question mark flashing on my start up screen. Can anyone help me with this?
Hello,
That means it can find the Hard Drive, or can't find the things needed for booting.
See if DU even sees it.
"Try Disk Utility
1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
*Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
3. Click the First Aid tab.
4. Select your Mac OS X volume.
5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
http://docs.info.apple.com/article.html?artnum=106214
Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
(Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.) -
Hi can anyone help with this issue regarding my wireless magic mouse? When im on google chrome and scrolling down the page i always have youtube running in the background but the audio cuts/spits/pops can anyone help me with this?
The figures you mention only make sense on your intranet. Are you still using the same wireless router. The verizon one is somewhat limited as far as max wireless-n performace. For one thing it only has a 2.4 radio. I like many people who wanted wireless-n performance before they even added a wireless-n gigabit router, have my own handling my wireless-n network.
-
When my screen saver has been on a while, I have to use the cursor to "rub out" part of the screen saver to see my login section. Can anyone help me with this?
I don't have a solution for you, but just wanted to let you know I used to have the exact same problem. I resolved it (for the most part....about 90% of the time, anyway) by adjusting the screensaver and power settings to never let the computer go to sleep.
-
(The iPhone "Named" cannot be restored at this time because the iPhone software update server could not be contacted or is temporarily unavailable.)
can anyone help me with this issue, every time i try to restore it will come up like this error message.Restore the iPhone when connected to iTunes by cable.
Still the same TS1275?
Is your iPhone jailbroken?
Or
Has your computer ever been used to jailbrake or downgrade (Tinyumbrella) any iPhone? -
When typing the name of the contact I want to send a text message to, names from my contact list no longer pop up as suggestions. Can anyone help me with this?
There's always a way to reset the device jmn33! Thanks for keeping us in the loop. To process a full reset/restore on the device please visit http://vz.to/12TLCsR. Please keep us posted once this is completed, thanks!
MatthewS_VZW
Follow us on Twitter @VZWSUPPORT -
My search bar for my iTunes library no longer works. Also, the menu bar is no longer visible. Noticed this problem last Saturday. This might be an issue with my desktop, and not iTunes itself Can anyone help me with this?
Press Ctrl-B to toggle the menu bar on and off.
When you say that the "search bar for my iTunes library no longer works" can you be more specific? The operation of the search function has changed in iTunes 12, essentially having two very distinct modes:
when Search Entire Library is checked, entering a search string will generate a dropdown of all matching items within your whole library, from which multiple operations are available via context menus
when Search Entire Library is unchecked, entering a search string creates a filtered view of whatever your current focus is (e.g., if you're looking at a playlist the filter applies only to items in that playlist) with none of the dropdown options as in the first case -
Can anyone help me with getting the best setting for me system
can anyone help me with getting the best setting for me system on cpufan it says my temp is 38c but on corecentre it says 42c can anyone help get my system overclocked any more but keeping it stable as well thanx in advance for the help
my corecenter temp sometimes says im at 60 cel at idle....and i have the most recent update...i would rely on speedfan for temp control...core center seems to always read 3 degrees higher than speedfan on my pc....
i wouldnt be too concerned...those temps are pretty low to begin with.
Maybe you are looking for
-
Re: New & Old Domains No Longer Accessible ?
Problem resolved: When changing directory permissions for whatever reason, make a note of what you changed the permissions from so that you can get them to be what they were originally after you are done with whatever caused you to change the dir per
-
Where can I download missing "Minion Pro" and "Myriad Pro" type fonts?
For some reason I have fewer Minion Pro & Myriad Pro type fonts on my Windows 7 home computer than I do on my Windows 7 work computer, and I'm trying to do the same commercial project with both of them. I have subscribed to Creative Cloud for over a
-
HDV looks jerky, convert to AIC and exported from FCE: more jerky
First of all, I am editing a video that was shot in Japan and captured with FCP, hence the footage has the HDV codec. When I view the footage in QT, it looks like the frame rate is messed up (the footage looks jerky, and you can see ghost trail type
-
Selection screen on moudle programming
The business needs selection parameter for select options to an existing module program. All the functionalities for a select-option in selection screen should be available. I know that we can have normal selection screen 1000 and then call the relav
-
How do you sync notes between ipad and macbook pro
I have numerous notes on my iPad mini and want to sync it with my MacBook Pro. How?