| Reply | « Previous Thread | Next Thread » |
|
What does this error mean,
Code:
javax.microedition.media.MediaException: Symbian OS error: -4 This is how I setup the camera; Code:
Thread thread = new Thread() {
public void run(){
try
{
player = Manager.createPlayer("capture://video");
player.addPlayerListener(playerListener);
player.realize();
videoControl = (VideoControl)player.getControl("VideoControl");
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, canvas);
int wh = Common.SCR_HEIGHT - Common.belowBannerY - 10 - Common.softKeyFn.getHeight();
videoControl.setDisplayLocation(Common.SCR_WIDTH/2 - wh/2, Common.belowBannerY + 10);
videoControl.setDisplaySize(wh, wh);
videoControl.setVisible(true);
player.start();
isPlayerOpen = true;
}
catch(Exception e)
{
// error
Common.debug("Camera Exception:"+e);
}
}
};
thread.start();
}
Code:
videoControl.setVisible(false);
progressBar = new ProgressBar("Capturing\nImage", this);
Runnable r = new Runnable(){
public void run() {
try
{
//byte[]imgData = videoControl.getSnapshot("encoding=jpeg&width=160&height=120");
byte[] imgData = null;
try
{
imgData = videoControl.getSnapshot("encoding=jpeg");
}
catch(OutOfMemoryError oome)
{
Common.debug("\nbefore cleanup OUT OF MEMORY:"+Runtime.getRuntime().freeMemory()+"\n");
System.gc();try{Thread.sleep(2000);}catch(Exception e1){}
Common.debug("\nafter cleanup OUT OF MEMORY:"+Runtime.getRuntime().freeMemory()+"\n");
}
taskOk(imgData);
}
catch(Exception e){
synchronized(this) {
isGettingSnapshot = false;
}
taskFail(e);
}
}
};
synchronized(this) {
isGettingSnapshot = true;
}
snapshotTask = new Task(this, r);
new Timer().schedule(snapshotTask, Common.SNAPSHOT_PERIOD_IN_SECS);
}
Last edited by earamsey : 2005-09-05 at 02:44.
|
|
hello, dingf006
my applition's error is "javax.microedition.media.mediaexception:symbian os error -5" tell me what's mistake please. |
|
check out this web site: Symbian OS Error Codes
Quote:
Erica A Ramsey / Mobile Apps Developer / Resume ~ http://home.comcast.net/~erica.ramsey/CV Some Project Screenshots ~ http://home.comcast.net/~erica.ramsey/CV/screens.html
Last edited by earamsey : 2008-05-08 at 16:26.
|
|
Hi yangjize,
as stated on the document linked by earamsey, -5 error means that the operation is not supported. Which device or emulator is giving you that error? If you can, try also posting the code that is throwing that Exception. Pit |
|
earamsey: i like the fact that you can help yangjize in your post by showing him symbian error codes and not look up ur own error code ;)
KErrNoMemory -4 "Not enough memory. Close some applications and try again" after 17 pictures your out of memory buddy ;) since you havent posted your full code i cant tell you exactly why you out of memory but i suspect that in the method "taskOk" you aggrigate the image data you recieved from the camera so .... dont do that ;) save to disk or somthing like that BR |
|
yes, if I recall, I was writing images to RMS. I don't think I collected them item into a array of 17 images, ie, Image[17]. I think that Nokia has some kind of bug in it with Canvas because I did display each image on Canvas after it was taken.
I think I traced the bug to someplace else though I don't quite remember this project. I remember creating my own widget library; I was using something called synclastui but after studying it's source code I decided to create my own less resource hungry version. I think that Nokia JVM needs a little more work on it. I Also had application that parsed larges amounts of XML, possible up to at least 1MB maybe more -- download from a server. Here I traced one of the problems there to kXML. It generates a new String everytime you call method to get an XML attribute, namespace, text, tag name and since there is potential of 10MB data many strings were getting creating during parse. I rewrote kXML to use char[] instead of calling new String(). Code:
private char [] chbuffer; Code:
struct {
byte [4] length;
byte [length] data;
}
I've decided to create a kXML replacement that works on above principal but it will use char[] instead of byte because for display I had to convert byte to char anyways. And I will write a WSDL command line tool that will generate Java code snippits from WSDL. I wish I had this when I wrote a previous project that communicated with .NET Web Services via SOAP. It was repetitive coding all of those kSOAP methods by hand. I don't use "javax.sax" because it is event driven and it is not standard across j2me implimentations and leads to source code fragmentation. I think i'll make xml parser/wsdl tools GPL of course, I could use the cash if someone it was sellable but I don't think developers buy j2me libraries... I don't. Except for Barcode scanner library but my last client purchased that not I. My next project will be DICOM viewer, maybe I can sell that to users since I will try to do it using J2ME; if this is possible. Well, thanks for help but that original post has long been over :D Bye! Erica A Ramsey / Mobile Apps Developer / Resume ~ http://home.comcast.net/~erica.ramsey/CV Some Project Screenshots ~ http://home.comcast.net/~erica.ramsey/CV/screens.html |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| AMR tp PCM using CMMFCodec on Symbian 8.0 (6630) | stew_mclean | Symbian Media (Graphics & Sounds) | 2 | 2005-12-15 06:53 |
| Current Symbian Development Opportunities...!! | mobile2004 | General Symbian C++ | 0 | 2005-01-17 18:58 |
| Global Symbian Development Opportunities *High Importance* | sara.lindsay | General Symbian C++ | 0 | 2004-05-21 12:16 |
| Global Symbian Development Opportunities *High Importance* | sara.lindsay | General Symbian C++ | 2 | 2004-05-08 10:09 |
| Global Symbian Development Opportunities *High Importance* | sara.lindsay | General Symbian C++ | 0 | 2004-05-07 12:45 |