Question

I programmed a bluetooth Television-Remote control for cellphones in J2ME using javax.microedition.lcdui.* (Gauge, List, ChoiseGroup) GUI-Elements.

I want the cellphone to have real-time interaction with my Television, I would like to find way to send user inputs performed with the GUI-Elements immediately (like changing the channel, or changing the volume) to the Television.

Since I want real-time interaction with my Television, I would like to find way to send user inputs performed with the GUI-Elements immediately (e.g. changing the channel, or changing the volume) to the TV.

Using javax.microedition.lcdui.Command / CommandListner and commandAction won't work since these need only recognize the commands selected with the side buttons. I would like to have something that can recognize any key pressed.

I discovered that Javax.microedition.lcdui.Canvas.keyPressed can handle any key pressed on the cellphone, but I don't know how to make Canvas work with MIDP GUI elements like Gauge. They can't be added like Commands.

Do I have to figure out way to build a interface for these GUI elements to make them work with Canvas?

Was it helpful?

Solution

I just found a half solution myself, if anyone is interested: "javax.microedition.lcdui.ItemStateListener". This function can handle the states (or state changes) of the GUI items in realtime. Its not keyPress, but this will work as well for my application.

OTHER TIPS

According to this FAQ you can't do what you are asking for. This is about MIDP 1.0, but I believe it also applies for MIDP 2.0. If it is only a gauge you need, you can easily paint it yourself.

From what I saw this can only be done using a Canvas.

I will strongly recommend that you should either draw your Gauge-like item on a Canvas object or you follow the advice given on Dec 19 at 15:00 by "zhengtonic". I dont know any other approach to this problem, I was once there but used the first options provided by me

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top