MMAPI: Moto Q8 emulator fails [message #25873] |
Tue, 13 January 2009 20:46 |
Eclipse User |
|
|
|
Originally posted by: news.s237965939.online.de
I'm working on a program which makes use of Midi playback. Now I
encountered an odd problem. Just by random i picked up the Moto Q8
emulator. My program successfuly runs on all other emulators I've tried.
So I tracked te problem down to the simplest possible example to show
the problem. The crash happens in the constructor of the canvas class.
Since it works on all other emulators I've checked, I ask myself what's
wrong with my code or what's wrong with the Moto Q8? I'm really clueless
here.
TIA,
Hans
================ TestQ8MIDlet.java, TOP OF FILE =================
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class TestQ8MIDlet extends MIDlet {
canvasQ8 cv;
public TestQ8MIDlet() {
cv = new canvasQ8();
}
protected void destroyApp(boolean arg0) throws
MIDletStateChangeException { }
protected void pauseApp() { }
protected void startApp() throws MIDletStateChangeException { }
}
=================== TestQ8MIDlet.java, BOTTOM OF FILE ===============
=================== canvasQ8.java, TOP OF FILE =================
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.media.Player;
import javax.microedition.media.PlayerListener;
public class canvasQ8 extends Canvas {
public class EventHandler implements PlayerListener {
public void playerUpdate(Player player, String event, Object
eventData) {
if (event == PlayerListener.END_OF_MEDIA) {
player.deallocate();
}
}
}
EventHandler myEventHandler;
public canvasQ8() {
// this line causes te crash
myEventHandler = new EventHandler();
}
protected void paint(Graphics arg0) { }
}
=================== canvasQ8.java, BOTTOM OF FILE =================
|
|
|
Re: MMAPI: Moto Q8 emulator fails [message #25914 is a reply to message #25873] |
Tue, 13 January 2009 20:53 |
Eclipse User |
|
|
|
Originally posted by: news.s237965939.online.de
Sorry I forgot to describe the crash. It's something like
java.lang.NoClassDefFoundError: javax/microedition/media/PlayerListener
Caused by: java.lang.ClassNotFoundException
Have they forgotten that class in the Q8 implementation?
Hans
|
|
|
|
Re: MMAPI: Moto Q8 emulator fails [message #26037 is a reply to message #25955] |
Wed, 14 January 2009 11:15 |
Eclipse User |
|
|
|
Originally posted by: news.s237965939.online.de
David Marques wrote:
> According to the MOTODEV Studio for Java ME documentation the MOTOQ8
> device does not support JSR135. So that is the reason why the class is
> not found.
Thanks, David. I've searched my Installation but can't find that
documentation which would be very useful for me. Next I would look for
is a device which offers player support but no MIDI to test my program
on that.
I'm just wondering that such an fancy looking, expensive device doesn't
offer media player functions, at least not for J2ME. I saw that it's
Windows Mobile based and I guess it's player can only be accessed
natively. I have experience with WM programming but that won't help me
here :(
Next question is how can check for availability of MMAPI Manger, Player
and other objects at runtime? That way I could just disable some
functionality on certain devices. I thought of something like
if(System.getProperty("xyz") == null) ... but which property?
Thanks again,
Hans
|
|
|
|
Re: MMAPI: Moto Q8 emulator fails [message #26158 is a reply to message #26078] |
Thu, 08 January 2009 14:47 |
Eclipse User |
|
|
|
Originally posted by: news.s237965939.online.de
wtv368@motorola.com (David Marques) schrieb:
>Hello Hans,
>
>Regarding the MOTODEV Studio documentation's location go into Help > Help
>Contents. A new window will be opened with the help documentation.
>
>Open the "MOTODEV Java ME API Documentation" section and look at the
>"MOTOROLA device feature matrix". It maps devices with JSRS and MOTOROLA
>proprietary apis. This will help you find out the device supporting any
>JSR.
>
>Regarding the availability of Players and other objects there are some
>aproaches you should try:
>
>1 - javax.microedition.media.Manager class has some helper functions to
>find out the supported media types and protocols.
>2 - There are several system properties as you expected. I have not found
>it on the MOTODEV Studio documentation (it must be missing) but if you
>look at WTK's documentation it will be there.
>3 - The last case would be trying to load a specific class and catch the
>ClassNotFoundException to disable some feature.
>
>Hope it answers all your questions.
Thanks again, David!
I'm gonna take a look when I'm back home. I've got just some info on
my USB stick right now. After I posted my last message, I found an
approach or better said workaround. I created a very first function
which needs yet more finework but for the beginning it works.
public static boolean isMidiAvailable() {
try {
Class.forName("javax.microedition.media.Manager");
} catch (ClassNotFoundException e) {
return false;
}
return true;
}
It's a bit clumsy though because some MMAPI functions require
exception handling like MediaException or something. Trying to
conditionally exclude them doesn't work.
if (isMidiAvailable() == true) {
..
.. // Do MIDI stuff here
..
}
Obviously there happen things under the hood during initialisation.
The pure existance of the MediaException try/catch causes a
ClassNotFound exception even if the context in which they stand is
never executed. So I splitted my Canvas into two classes. One without
Midi and one derived from that with Midi and depending on the function
above I create either the one or the other. The midi stuff is in the
canvas because graphics and music often go hand in hand :) I'm gonna
take a look at the other options too.
All the best,
Hans
|
|
|
Re: MMAPI: Moto Q8 emulator fails [message #570720 is a reply to message #25873] |
Tue, 13 January 2009 20:53 |
Eclipse User |
|
|
|
Originally posted by: news.s237965939.online.de
Sorry I forgot to describe the crash. It's something like
java.lang.NoClassDefFoundError: javax/microedition/media/PlayerListener
Caused by: java.lang.ClassNotFoundException
Have they forgotten that class in the Q8 implementation?
Hans
|
|
|
|
Re: MMAPI: Moto Q8 emulator fails [message #570804 is a reply to message #25955] |
Wed, 14 January 2009 11:15 |
Eclipse User |
|
|
|
Originally posted by: news.s237965939.online.de
David Marques wrote:
> According to the MOTODEV Studio for Java ME documentation the MOTOQ8
> device does not support JSR135. So that is the reason why the class is
> not found.
Thanks, David. I've searched my Installation but can't find that
documentation which would be very useful for me. Next I would look for
is a device which offers player support but no MIDI to test my program
on that.
I'm just wondering that such an fancy looking, expensive device doesn't
offer media player functions, at least not for J2ME. I saw that it's
Windows Mobile based and I guess it's player can only be accessed
natively. I have experience with WM programming but that won't help me
here :(
Next question is how can check for availability of MMAPI Manger, Player
and other objects at runtime? That way I could just disable some
functionality on certain devices. I thought of something like
if(System.getProperty("xyz") == null) ... but which property?
Thanks again,
Hans
|
|
|
|
Re: MMAPI: Moto Q8 emulator fails [message #570881 is a reply to message #26078] |
Thu, 08 January 2009 14:47 |
Eclipse User |
|
|
|
Originally posted by: news.s237965939.online.de
wtv368@motorola.com (David Marques) schrieb:
>Hello Hans,
>
>Regarding the MOTODEV Studio documentation's location go into Help > Help
>Contents. A new window will be opened with the help documentation.
>
>Open the "MOTODEV Java ME API Documentation" section and look at the
>"MOTOROLA device feature matrix". It maps devices with JSRS and MOTOROLA
>proprietary apis. This will help you find out the device supporting any
>JSR.
>
>Regarding the availability of Players and other objects there are some
>aproaches you should try:
>
>1 - javax.microedition.media.Manager class has some helper functions to
>find out the supported media types and protocols.
>2 - There are several system properties as you expected. I have not found
>it on the MOTODEV Studio documentation (it must be missing) but if you
>look at WTK's documentation it will be there.
>3 - The last case would be trying to load a specific class and catch the
>ClassNotFoundException to disable some feature.
>
>Hope it answers all your questions.
Thanks again, David!
I'm gonna take a look when I'm back home. I've got just some info on
my USB stick right now. After I posted my last message, I found an
approach or better said workaround. I created a very first function
which needs yet more finework but for the beginning it works.
public static boolean isMidiAvailable() {
try {
Class.forName("javax.microedition.media.Manager");
} catch (ClassNotFoundException e) {
return false;
}
return true;
}
It's a bit clumsy though because some MMAPI functions require
exception handling like MediaException or something. Trying to
conditionally exclude them doesn't work.
if (isMidiAvailable() == true) {
..
.. // Do MIDI stuff here
..
}
Obviously there happen things under the hood during initialisation.
The pure existance of the MediaException try/catch causes a
ClassNotFound exception even if the context in which they stand is
never executed. So I splitted my Canvas into two classes. One without
Midi and one derived from that with Midi and depending on the function
above I create either the one or the other. The midi stuff is in the
canvas because graphics and music often go hand in hand :) I'm gonna
take a look at the other options too.
All the best,
Hans
|
|
|
Powered by
FUDForum. Page generated in 0.04745 seconds