1

I developed an application in j2me, it is executing successfully. In future, if there is any issue in my statements, I want to debug my application. I know that, I can use System.out.println() but I want to log a statement, how can I do it in j2me? if possible provide me a sample code?

Kalai Selvan Ravi
  • 2,846
  • 2
  • 16
  • 28
String
  • 3,660
  • 10
  • 43
  • 66

1 Answers1

2

Simply

public static void logToConsole(String str) {

     System.out.println(str);

}

Declare it in your utility class and use it.

If you want to get a screen logger put your messages in it and display it on the canvas.

//Vector which will hold your logs

private static Vector logData = new Vector();

public static void logToScreen(String str) {

    logData.add(str);

}

Now use it in your canvas.

public static Vector getLogData() {

    return logData;

}

Ameer Moaaviah
  • 1,530
  • 12
  • 27