查看手机对Java的支持情况
来源:互联网 发布:手机淘宝宝贝上架技巧 编辑:程序博客网 时间:2024/04/29 15:58
为了查看各种各样的手机对Java的支持情况,特地编写了本程序。
程序是用J2ME开发的,很简单,只有两个类,编译打包成.jar文件后即可在手机上运行。
入口类
package org;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
public class ViewMidlet extends MIDlet{
private J2MEInfo info;
public ViewMidlet(){
info=new J2MEInfo(this);
}
public Display getDisplay(){
return Display.getDisplay(this);
}
public void startApp() {
getDisplay().setCurrent(info);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
}
处理类
package org;
import javax.bluetooth.LocalDevice;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
public class J2MEInfo extends Form implements CommandListener {
private ViewMidlet main;
private Command about;
private Command exit;
public J2MEInfo(ViewMidlet main) {
super("手机J2ME属性");
this.main=main;
init();
}
/**
* 初始化参数
*/
private void init() {
about = new Command("关于", Command.OK, 1);
exit = new Command("退出", Command.EXIT, 1);
this.addCommand(about);
this.addCommand(exit);
this.setCommandListener(this);
display();
}
/**
* 显示J2ME属性
*/
private void display() {
String[] keys = {"平台:", "编码:", "MIDP:", "CLDC:", "PIM:", "文件系统:"};
String[] values = {"microedition.platform", "microedition.encoding", "microedition.profiles",
"microedition.configuration", "microedition.pim.version", "microedition.io.file.FileConnection.version"};
for (int i = 0; i < keys.length; i++) {
StringItem item = new StringItem(keys[i], getInfo(1, values[i]));
this.append(item);
}
StringItem item2 = new StringItem("蓝牙:", getInfo(2, "bluetooth.api.version"));
this.append(item2);
}
/**
* 获取J2ME属性
* @param type 1代表从System类获取属性,2代表从LocalDevice类获取属性
* @param property 属性名
* @return 支持的版本号
*/
private String getInfo(int type, String property){
String value = null;
if(type == 1){
value = System.getProperty(property);
}else{
value = LocalDevice.getProperty(property);
}
if(value == null || value.trim().equals(""))
return "不支持";
else
return value;
}
public void commandAction(Command c, Displayable d) {
if (c == about) {
main.getDisplay().setCurrent(new Alert("关于/n",
"手机J2ME属性/n版本:1.0.2",null,AlertType.INFO), this);
} else if (c == exit) {
main.notifyDestroyed();
main.destroyApp(true);
}
}
}
- 查看手机对Java的支持情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 检测手机对MMAPI支持的情况
- 快速测试手机浏览器对HTLM5的详细支持情况
- 测试手机对J2ME支持情况
- java 对各个盘符的使用情况进行查看
- 手机编码支持情况
- 各浏览器对HTML5的支持情况
- 各浏览器对HTML5的支持情况
- Exchange 中配置 SMTP 连接器以链接到 Internet 域
- 做完一个小网站的一点经验总结(1)和(2): asp.net 与access数据库结合(已合成)
- 【Trufun升级公告】升级版V2.3.5
- CSDN又抽风了,补发昨天写的……
- 2007 年软考 令人悲愤的成绩.
- 查看手机对Java的支持情况
- 关于在Eclipse中Tomcat不能启动的问题(附MyEclipse6&MyEclipse5.5破解)
- 彩信的基本原理
- 关于国企和外企比较的详解
- PostgreSQL数据库bat文件的制作
- axTocControl右键菜单处理
- 使用microsoft visual c++来检测和隔离内存泄漏
- 永远不要跟父母说的十句话,谁没说过?
- 匿名管道