1

I developed an mobile application using LWUIT and it works fine in devices with J2ME. I want to run the same application in Blackberry also. I saw some samples about LWUIT on Blackberry but none of them answered me.

How can I handle the back button on the device to make back movements? What I mean is that, when I press the back button on the device, I want the application move to the previous screen.

I used regular buttons to handle back movements just for now, but when we think of user side, it is not so friendly.

I dont want to use commands like I did in j2ME app., because it seems not so nice.

Is there anyone who can solve it?

bharath
  • 14,283
  • 16
  • 57
  • 95
nhr
  • 15
  • 2

1 Answers1

1

Set a particular back command to the form. For example,

Command backCmd = new Command("Back"){

public void actionPerformed(ActionEvent evt) {
   previousForm.show();
  }
};

currentForm.setBackCommand(backCmd);
frayab
  • 2,512
  • 20
  • 25
bharath
  • 14,283
  • 16
  • 57
  • 95
  • thanks for answer,I did the same just for now, but this is not what I mean, I think I couldn't explain the problem. The problem is handling the button on the device, not commands in application. Do you have any suggestions? – nhr Jan 30 '12 at 12:12
  • Look on [`button.getCommand()`](http://lwuit.java.net/javadocs/com/sun/lwuit/Button.html#getCommand()). I didn't check this before. So Just test it and let me. – bharath Jan 30 '12 at 12:37
  • actually, previously, same as back button, my trackball and delete buttons has been also not worked, but I was able to handle them with doing some changes with their keycodes(ASCII values) on LWUIT libraries, and I succeed, but this did not work on back button. I have already checked 'button.getCommand()' and 'form.setBackCommand()' but it didn't help. when I use setBackCommand ,, it seems to do something (it activates the internet connection) but, still does not go back to previous screen – nhr Jan 30 '12 at 12:46
  • 1
    It sounds like you compiled the LWUIT J2ME code instead of using the proper LWUIT Blackberry port. – Shai Almog Feb 01 '12 at 20:04
  • Sorry, but I am not sure about your comment. Whaat you mean by LWUIT BB port? Did you mean using RIM JDE or something else? – nhr Feb 07 '12 at 11:08