0

In my LWUIT j2me app, i have a user editable textfield where the user enters some values, and that is appended in my sms content. Later the user clicks "send" and the sms goes to number that i have written in the code("sms://9900110010").

Requirement: The user should be able to edit the sms sending number rather than me editing in the code and save the number for future "send".

What i have tried: i created "settings" command in the menu which on click, takes to new form with new textfield and "save" command. I have opened an rms recordstore to save the number; now since it is a string that saves the number, how do i call it in between "sms://"?

OR is there any other way to do this?

so, Need serious help people.

Nikhil
  • 1,279
  • 2
  • 23
  • 43

1 Answers1

1

Just append the string that stores the number to : "sms://" . You can do it like this:

First, Store the textfield contents in a recordstore. Then:

1)Open your Record Store. 2)Read the number from the Recordstore. 3)Store the number in a string

Then:

String stringWhichStoresTheNumber ="9999999999"; //obtained from RMS

String sms = "sms://";

sms= sms+ stringWhichStoresTheNumber;

-Nikhil

Nikhil
  • 1,279
  • 2
  • 23
  • 43
  • thanks for your reply nikhil,can you give me an example just the process you have explained there, plz, i am new to this j2me.. –  Mar 15 '12 at 07:32
  • you can get the textfield contents as follows: String textContent = yourTextField.getText(); So now you can store this in recordstore. Why not google the rest of the steps? There are plenty of examples on the net. – Nikhil Mar 15 '12 at 09:15
  • ok i did exactly what you told me to, it is working untill the application is open, but once i close the app, and open it back again, just click on "send", it gives me null pointer exception and i have to go back to the txtfield to enter the number and then start sending, it works,.. SO please need help.. –  Mar 16 '12 at 08:01
  • Check the code related to your recordstore. You are probably not using the recordstore correctly. Try attaching a debugger in netbeans and debugging your program. – Nikhil Mar 16 '12 at 08:27
  • i dont know how to evoke the last saved number.. when the midlet opens,, or i dont know if it is possible.. please help. Basically all i want is i have to retrieve the last saved number in that textfield. Please help me with this.. –  Mar 16 '12 at 08:29
  • When the midlet opens: 1) Open the recordstore. Make sure that the recordstore contains your number. You need to have stored the number when you typed the number for the first time. 2)Read the number as string, store it in a variable and then append the variable to "sms://" as described in the answer. – Nikhil Mar 16 '12 at 08:59