本文整理汇总了Java中javax.microedition.midlet.MIDlet.getAppProperty方法的典型用法代码示例。如果您正苦于以下问题:Java MIDlet.getAppProperty方法的具体用法?Java MIDlet.getAppProperty怎么用?Java MIDlet.getAppProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.midlet.MIDlet
的用法示例。
在下文中一共展示了MIDlet.getAppProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateAdminUser
import javax.microedition.midlet.MIDlet; //导入方法依赖的package包/类
public static void populateAdminUser(MIDlet m) {
IStorageUtility users = StorageManager.getStorage(User.STORAGE_KEY);
boolean adminFound = false;
IStorageIterator ui = users.iterate();
while (ui.hasMore()) {
User user = (User)ui.nextRecord();
if (User.ADMINUSER.equals(user.getUserType())) {
adminFound = true;
break;
}
}
// There is no admin user to update, so add the user
if(!adminFound) {
//TODO: Test for MIDlet-Jar-RSA-SHA1 or other signing mechanism before allowing the property to be pulled?
String defaultFromEnvironment = m == null ? null : m.getAppProperty(ADMIN_PW_PROPERTY);
User admin = new User("admin", defaultFromEnvironment != null ? defaultFromEnvironment : defaultPassword, PropertyUtils.genGUID(25), User.ADMINUSER);
admin.setUuid(PropertyManager._().getSingularProperty("DeviceID"));
users.write(admin);
}
}
示例2: isEnabled
import javax.microedition.midlet.MIDlet; //导入方法依赖的package包/类
/**
* Checks the value of a Jad attribute and returns the corresponding
* boolean value.
* Only attributes that have <code>enabled</code> and <code>disabled</code>
* should be used with this method.
*
* @param midlet the MIDlet which Jad attributes to read.
* @param id logging setup identifier or <code>null</code> to use common logging setup.
* @param attrName name of the attribute to check.
* @param defaultValue default value to be used in case the attribute is not defined.
*
* @return <code>true</code> if the specified attribute has the value
* <code>enabled</code> and <code>false</code> otherwise.
*/
private static final boolean isEnabled(MIDlet midlet, String id, String attrName, boolean defaultValue) {
String origAttrName = attrName;
if (id != null) {
// Read setup specific attribute first.
attrName = id + "-" + attrName;
}
String value = midlet.getAppProperty(attrName);
if (value == null) {
if (id != null) {
// Setup specific value not specified - use common logging setup instead.
return isEnabled(midlet, null, origAttrName, defaultValue);
}
return defaultValue;
} else if (value.equalsIgnoreCase("enabled")) {
return true;
} else {
return false;
}
}
示例3: RMSRecoveryHook
import javax.microedition.midlet.MIDlet; //导入方法依赖的package包/类
public static void RMSRecoveryHook (MIDlet midlet) {
String action = midlet.getAppProperty("RMS-Image");
String path = midlet.getAppProperty("RMS-Image-Path");
if ("dump".equals(action)) {
System.out.println("Dumping RMS image...");
dumpRMS(path);
} else if ("restore".equals(action)) {
System.out.println("Restoring RMS image...");
restoreRMS(path);
}
}
示例4: init
import javax.microedition.midlet.MIDlet; //导入方法依赖的package包/类
/**
* @inheritDoc
*/
public void init(Object m) {
canvas = createCanvas();
canvas.setTitle(null);
if(!disableFullScreen) {
canvas.setFullScreenMode(!com.codename1.ui.Display.getInstance().isNativeCommands());
}
// disable the flashGraphics bug on Nokia phones
String platform = System.getProperty("microedition.platform");
if (platform != null && platform.toUpperCase().indexOf("NOKIA") >= 0) {
flushGraphicsBug = false;
NOKIA = true;
// Symbian devices should yield a bit to let the paint thread complete its work
// problem is we can't differentiate S40 from S60...
Display.getInstance().setTransitionYield(1);
//nokia devices cannot use OutputStreamWriter flush when using
//MultipartRequest
MultipartRequest.setCanFlushStream(false);
} else {
flushGraphicsBug = true;
Display.getInstance().setTransitionYield(-1);
}
mid = (MIDlet)m;
display = javax.microedition.lcdui.Display.getDisplay(mid);
setSoftKeyCodes(mid);
if(mid.getAppProperty("forceBackCommand") != null) {
canvas.setCommandListener((CommandListener) canvas);
canvas.addCommand(MIDP_BACK_COMMAND);
}
RecordEnumeration e = null;
RecordStore r = null;
try {
r = RecordStore.openRecordStore("FAT", true);
if (r.getNumRecords() > 0) {
e = r.enumerateRecords(null, null, false);
while (e.hasNextElement()) {
byte[] rec = e.nextRecord();
ByteArrayInputStream bi = new ByteArrayInputStream(rec);
DataInputStream di = new DataInputStream(bi);
String name = di.readUTF();
short key = di.readShort();
di.close();
bi.close();
fat.put(name, new Short(key));
if(key >= currentKey) {
currentKey += key;
}
}
e.destroy();
e = null;
}
r.closeRecordStore();
r = null;
} catch (Exception ex) {
ex.printStackTrace();
cleanup(r);
cleanup(e);
}
}