简单的Demo
下面是简单的测试环境的代码,有经验的朋友可以很容易就就跑起来。
代码片段
/** * getSysInfo */ private void getSysInfo() { addInfo("Microedition Configuration: ", getInfo(System.getProperty("microedition.configuration")));
getInfo(System.getProperty("microedition.profiles")));
getInfo(System.getProperty("microedition.jtwi.version")));
getInfo(System.getProperty("microedition.platform")));
getInfo(System.getProperty("microedition.locale")));
getInfo(System.getProperty("microedition.encoding")));
getInfo(System.getProperty("microedition.commports")));
getInfo(System.getProperty("microedition.hostname")));
addInfo(" microedition.smartcardslots", getInfo(System.getProperty(" microedition.smartcardslots")));
getInfo(System.getProperty("com.nokia.network.access")));
getInfo(System.getProperty("com.nokia.mid.dateformat")));
getInfo(System.getProperty("com.nokia.mid.timeformat")));
addInfo("com.nokia.memoryramfree", getInfo(System.getProperty("com.nokia.memoryramfree")));
getInfo(System.getProperty("com.nokia.mid.batterylevel")));
getInfo(System.getProperty("com.nokia.mid.countrycode")));
getInfo(System.getProperty("com.nokia.mid.networkstatus")));
getInfo(System.getProperty("com.nokia.mid.networksignal"))); addInfo("com.nokia.mid.networkid", getInfo(System.getProperty("com.nokia.mid.networkid"))); addInfo("com.nokia.mid.networkavailability", getInfo(System.getProperty("com.nokia.mid.networkavailability"))); addInfo("com.nokia.mid.cellid", getInfo(System.getProperty("com.nokia.mid.cellid"))); addInfo("com.nokia.mid.imei", getInfo(System.getProperty("com.nokia.mid.imei"))); addInfo("com.nokia.mid.imsi", getInfo(System.getProperty("com.nokia.mid.imsi")));
StringBuffer timeZonesBuffer = new StringBuffer(); for (int i = 0; i < timeZoneIDs.length; i++) { timeZonesBuffer.append(timeZoneIDs[i]).append('\n'); }
Long.toString(Runtime.getRuntime().totalMemory()) + " bytes");
Long.toString(Runtime.getRuntime().freeMemory()) + " bytes"); addInfo("Available TimeZones:", timeZonesBuffer.toString());
addInfo("com.siemens.mp.lcdui.Image", hasClassExit("com.siemens.mp.lcdui.Image") + ""); addInfo("com.motorola.phonebook.PhoneBookRecord", hasClassExit("com.motorola.phonebook.PhoneBookRecord") + ""); addInfo("com.motorola.Dialer", hasClassExit("com.motorola.Dialer") + ""); addInfo("com.jblend.util.Case", hasClassExit("com.jblend.util.Case") + ""); addInfo("com.samsung.util.AudioClip", hasClassExit("com.samsung.util.AudioClip") + ""); addInfo("com.mot.iden.multimedia.Lighting", hasClassExit("com.mot.iden.multimedia.Lighting") + ""); } private boolean hasClassExit(String aClassName) { try { Class.forName(aClassName); return true; } catch (Exception e) { return false; } }
if (info == null) { return "<unknown>"; } else { return info; } } public void addInfo(String name, String value) { iForm.append(new StringItem(name, value)); } |