Hello, good evening. :)

This is a thesis. My thesis is "SMS Textspeak Corrector". SMS Textspeak Corrector is a text messaging software for mobile phone where users can convert or correct the “txt spk” message to the original normal words. For instance, it will correct the “txt spk” text message to “text speak” when a user send the message to the recipient. So the recipient will receive the complete words of text message in his mobile phone.

Please take a look my code. I having a problem in replacing the text inside the TextBox.

Here's the code:

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.TextBox;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Command;

public class TextBoxMIDlet extends MIDlet implements CommandListener
{
  private Display display;
  private static String[] txtWord = {"txt","spk","lol","np","brb"};
  private static String[] realWord = {"text","speak","laugh out loud","no problem","be right back"};
  private Command txtspk = new Command("Correct Textspeak", Command.ITEM, 0);
  private Command exit = new Command("Exit", Command.EXIT, 0);
  private TextBox t;

  public TextBoxMIDlet() {
    display = Display.getDisplay(this);
  }

  public void startApp() {
      t = new TextBox ("TextBox Example", null, 256, TextField.ANY);
      t.addCommand(txtspk);
      t.addCommand(exit);
      t.setCommandListener(this);
      display.setCurrent(t);
  }

  public void pauseApp() {}

  public void destroyApp(boolean unconditional){}

  public void commandAction(Command command, Displayable displayable)
  {
      if (command == exit)
      {
          destroyApp(true);
          notifyDestroyed();
      }
      if (command == txtspk)
      {
          for(int a = 0; a < txtWord.length; a++)
          {
              if(t.equals(txtWord[a]))
              {
                  t = t.replaceAll(txtWord[a], realWord[a]);
              }
          }
          System.out.println(t);
      }
  }
}

I'm having a problem with this this part:

if (command == txtspk)
      {
          for(int a = 0; a < txtWord.length; a++)
          {
              if(t.equals(txtWord[a]))
              {
                  t = t.replaceAll(txtWord[a], realWord[a]);
              }
          }
          System.out.println(t);
      }

I don't know how to figure it out. What's the exact syntax should I put there?

Hope someone will help me with this.

Thanks advance. :)

Anyone?

Not 24/7 school assignments service. I May have look later on, but no promises since I will have to install JME emulator

Hello peter, good evening. :)

Thanks for replying my problem peter. Ok I'll just wait your next post. Hope you can help me.

Thanks advance. :)

Anyone?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.