Categories: Java | How To | Code Examples | Debugging
This page was last modified 08:55, 25 September 2007.
Output data
From Forum Nokia Wiki
It is a common way to use System.out.println("whatever output information"); lines in Java code for getting output from a MIDlet, while developing MIDlets. This works well in SDKs, while it is more difficult to get information, when MIDlet is run in a real device. Simple way of getting output is using Alert Screen for getting output. This is especially useful for getting error messages from Exceptions. The following code shows, how to use Alerts for this:
void alertError(String message) { Alert alert = new Alert("Error", message, null, AlertType.ERROR); Display display = Display.getDisplay(this); Displayable current = display.getCurrent(); if (! (current instanceof Alert)) { // This next call can't be done when current is an Alert display.setCurrent(alert, current); } }
Then you can call the method for example like this:
try { player = Manager.createPlayer(song); player.addPlayerListener(this); player.realize(); vc = (VolumeControl) player.getControl("VolumeControl"); vc.setLevel(50); player.setLoopCount( -1); player.prefetch(); player.start(); } catch (IOException ioe) { alertError("IOException: " + ioe.getMessage()); } catch (MediaException me) { alertError("MediaException: " + me.getMessage()); }
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I cannot get records from RMS while executing in NOKIA 6600 | hithayath_sait | General Symbian C++ | 0 | 2006-06-01 11:19 |
| How to specify PrepareVideoCaptureL arguments? | Augstin | Symbian Media (Graphics & Sounds) | 5 | 2007-06-19 06:42 |
| Carbide.c++ console cleans up!! | cassioli | Symbian Tools & SDKs | 2 | 2007-02-05 12:39 |
| XSLT Support | micmen | General Browsing | 10 | 2005-06-27 18:49 |
| Nokia 6131 audio capture | Alex_Polt | Mobile Java Media (Graphics & Sounds) | 2 | 2007-03-15 13:37 |
