【发布时间】:2012-08-28 14:27:42
【问题描述】:
我在 j2me 中开发了一个应用程序,它正在成功执行。将来,如果我的陈述中有任何问题,我想调试我的应用程序。我知道,我可以使用 System.out.println() 但我想记录一个语句,我该如何在 j2me 中做到这一点?如果可能的话,给我一个示例代码?
【问题讨论】:
我在 j2me 中开发了一个应用程序,它正在成功执行。将来,如果我的陈述中有任何问题,我想调试我的应用程序。我知道,我可以使用 System.out.println() 但我想记录一个语句,我该如何在 j2me 中做到这一点?如果可能的话,给我一个示例代码?
【问题讨论】:
简单
public static void logToConsole(String str) {
System.out.println(str);
}
在您的实用程序类中声明并使用它。
如果您想获得屏幕记录器,请将您的消息放入其中并在画布上显示。
//Vector which will hold your logs
private static Vector logData = new Vector();
public static void logToScreen(String str) {
logData.add(str);
}
现在在你的画布中使用它。
public static Vector getLogData() {
return logData;
}
【讨论】: