无花的空间--http://wuhua.3geye.net

当你来到我的空间的时候,你会看到很多Google,Nokia,Mobile,J2ME ,Android,3G,无线开发,手机软件,手机软件开发等与Google,手机相关的文章,你千万不要惊讶。这就是我一个专注Google,无线开发的无花。传播知识,分享经验,技术交流是我开空间的直接目的。当然如果有项目开发,我还是很希望赚点外快的。

饶荣庆ID:gooogledev
35144次访问,排名3096好友5人,关注者11
J2EE 2年的开发时间,
J2ME 2年的开发时间
gooogledev的文章
原创 78 篇
翻译 0 篇
转载 3 篇
评论 197 篇
无花的公告

人要吃很多苦才可以长大!

踏实平凡人应该遵守的原则!

与我TM

gooogledev@gmail.com

友情链接

我的j2me创意

Wap浏览器的源代码

用自己写的rms引擎写的电话本

RSS订阅此博客  
用抓虾订阅此博客
用google订阅此博客
用bloglines订阅此博客
    网络封神榜 | 饶荣庆
最近评论
zryStar:嘿嘿,向楼主学习,对这行了解不是很深,希望学到东西
nike shoes:[url=http://www.molybdenum-tungsten.com]tungsten carbide[/url]
[url=http://www.66773388.com]nike shoes[/url]
[url=http://www.66773388.com]jordan shoes[/url]
[url=http://www.66773388……
vvukqr:a href="http://www.xowow.com">WoW Gold
arvin:flags是boolean[] 类型
if(flags)是什么意思
要想取得ChoiceGroup选中的值采用这种方式:
//ChoiceGroup cg;
//len 为cg的选择列长度
booean[] flags = new boolean[len];
cg.getSelectedFlags(flags);

zjsjava:顶,或许以后J2ME的框架对解决移植问题变的容易多了
文章分类
收藏
    相册
    j2me创意图片
    j2me教程
    我的照片
    我的链接
    3G视线
    EasyMF J2ME框架
    Lucene中国
    我的Google
    无花的博客
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 手机J2ME环境测试程序--测试手机对jsr的支持以及其他信息收藏

    新一篇: J2ME Polish 全攻略之入门 | 旧一篇: 深入分析J2ME平台MIDP低级事件处理机制

    原文地址

    相信做手机开发的都知道,write once debug anywhere。你向从中体验乐趣吗,那先来了解下手机对JSR规范的支持吧。
    下面是我从网络上获取一些的信息。
    其中一个源代码出自http://www.javaeye.com/topic/75387
    大家可以到上面下载源代码,然后稍微修改下,就可以提供对jsr的更多测试了。
    关于测试的方面看下面

    For instance, the property microedition.commports is present in the MIDP 2.0 specification. Its value is a comma-separated list of ports you can use to build a URL, which the Generic Connection Framework can in turn use to create a javax.microedition.io.CommConnection object.
    To query system properties use java.lang.System.getProperty(), as in:

    import java.lang.*;

    String value;
    String key = "microedition.pim.version";

    value = System.getProperty( key );
    ...



    This table lists the defined system properties, drawing them from JSRs that are in the public review, final ballot, or final state, as defined in the Java Community Process (JCP):

    J2ME Defined System Properties

    JSR Property Name
    Default Value¹
    30 microedition.platform null
    microedition.encoding ISO8859_1
    microedition.configuration CLDC-1.0
    microedition.profiles null
    37 microedition.locale null
    microedition.profiles MIDP-1.0
    75 microedition.io.file.FileConnection.version 1.0
    file.separator (impl-dep)
    microedition.pim.version 1.0
    118 microedition.locale null
    microedition.profiles MIDP-2.0
    microedition.commports (impl-dep)
    microedition.hostname (impl-dep)
    120 wireless.messaging.sms.smsc (impl-dep)
    139 microedition.platform (impl-dep)
    microedition.encoding ISO8859-1
    microedition.configuration CLDC-1.1
    microedition.profiles (impl-dep)
    177 microedition.smartcardslots (impl-dep)
    179 microedition.location.version 1.0
    180 microedition.sip.version 1.0
    184 microedition.m3g.version 1.0
    185 microedition.jtwi.version 1.0
    195 microedition.locale (impl-dep)
    microedition.profiles IMP-1.0
    205 wireless.messaging.sms.smsc (impl-dep)
    205 wireless.messaging.mms.mmsc (impl-dep)
    211 CHAPI-Version 1.0

    这个是e文的

    看看中文的吧

    2.3.4 MIDP应用程序的属性

    MIDlet可以访问两种运行时的属性值:系统属性和应用程序属性。

    1.系统属性

    系统属性是在CLDC(Connected Limited Device Configuration)中定义的,属性值被写入底层的系统,我们可以读取它们,但是不能修改这些属性值。如果想读取一个系统属性值,那么可以使用 System类的静态方法System.getProperty()来读取。有时候我们可能想读取特定手机的系统信息,比如IMEI号。解决办法就是去参 考这款手机的开发指南和规范,比如,从SonyEricsson系列手机读取IMEI号,调用方法:System.getProperty ("com. onyericsson.imei"),这时将返回手机的IMEI号码,如IMEI 123456-00-123456-1-00。需要说明的一点是,在SonyEricsson P910上查询IMEI号码时,传递的字符串参数应该是com.sonyericsson.IMEI(IMEI须大写)。如果在不支持此项功能的手机上查 询IMEI号时,将什么都不返回,例如,在T610上调用。

    表2-3列举了系统属性。

    表2-3 MIDP应用程序系统属性

    JSR

    属性名称

    30

    microedition.platform

    null


    microedition.encoding

    ISO8859_1


    microedition.configuration

    CLDC-1.0


    microedition.profiles

    null

    37

    microedition.locale

    null


    microedition.profiles

    MIDP-1.0

    75

    microedition.io.file.FileConnection.version

    1.0


    file.separator

    依赖于底层实现


    microedition.pim.version

    1.0

    118

    microedition.locale

    null


    microedition.profiles

    MIDP-2.0


    microedition.commports

    依赖于底层实现


    microedition.hostname

    依赖于底层实现

    120

    wireless.messaging.sms.smsc

    依赖于底层实现

    139

    microedition.platform

    依赖于底层实现


    microedition.encoding

    ISO8859-1


    microedition.configuration

    CLDC-1.1


    microedition.profiles

    依赖于底层实现

    177

    microedition.smartcardslots

    依赖于底层实现

    179

    microedition.location.version

    1.0

    180

    microedition.sip.version

    1.0

    184

    microedition.m3g.version

    1.0

    185

    microedition.jtwi.version

    1.0

    195

    microedition.locale

    依赖于底层实现


    microedition.profiles

    IMP-1.0

    205

    wireless.messaging.sms.smsc

    依赖于底层实现

    205

    wireless.messaging.mms.mmsc

    依赖于底层实现

    2.应用程序属性

    应用程序属性值是在应用程序描述符文件或者MANIFEST文件中定义的,当我们部署应用程序的时候可以定义应用程序属性。比如下面是一个典型的JAD文件内容。

    MIDlet-1: HttpWrapperMidlet,httpwrapper.HttpWrapperMIDlet

    MIDlet-Jar-Size: 16315

    MIDlet-Jar-URL: HttpWrapper.jar

    MIDlet-Name: HttpWrapper

    MIDlet-Vendor: Vendor

    MIDlet-Version: 1.0

    MicroEdition-Configuration: CLDC-1.0

    MicroEdition-Profile: MIDP-1.0

    Which-Locale: en

    其中Which-Locale就是应用程序属性值,我们可以通过MIDlet的成员方法getAppProperty()来得到它,代码片断如下:

    import javax.microedition.midlet.*;

    public class MyMIDlet extends MIDlet {

    private String suiteName;

    private String which_locale;

    public MyMIDlet(){

    suiteName = getAppProperty( "MIDlet-Name" );

    which_locale = getAppProperty("Which-Locale");

    }

    //这里省略了其他代码

    }

    属性值对大小写是敏感的,如果属性值在底层系统、JAD文件和Manifest文件中都没有定义的话,那么将返回Null。

    熟悉MIDP应用程序的系统属性对我们开发灵活、强大的MIDlet至关重要。可以根据系统属性返回值来动态地生成应用程序的菜单。例如,通过判断底层系统是否支持MMAPI来决定应用程序中是否要添加摄像功能。下面的例子演示了如何在MIDlet中读取系统属性。

    package com.j2medev.ch3.property;

    import javax.microedition.lcdui.*;

    import javax.microedition.midlet.*;

    public class DetectMIDlet extends MIDlet {

    private static DetectMIDlet instance = null;

    private Display display = null;

    private Displayable form = null;

    public DetectMIDlet() {

    instance = this;

    }

    protected void startApp() {

    if(display==null) {

    //首次启动应用程序

    display = Display.getDisplay(this);

    form = new TestForm();

    display.setCurrent(form);

    } else{

    display.setCurrent(form);

    }

    }

    protected void pauseApp() {}

    protected void destroyApp(boolean unconditional) {}

    public static void quitApp() {

    instance.destroyApp(true);

    instance.notifyDestroyed();

    instance = null;

    }

    }

    class TestForm extends Form implements CommandListener {

    private Command exit = new Command("退出", Command.EXIT, 0);

    public TestForm() {

    super("J2ME平台测试");

    String s;

    //CLDC版本属性

    s = System.getProperty("microedition.configuration");

    append(getValue("CLDC版本", s));

    //MIPD版本属性

    s = System.getProperty("microedition.profiles");

    append(getValue("MIDP版本",s));

    s = System.getProperty("microedition.platform");

    append(getValue("软件平台", s));

    s = System.getProperty("microedition.encoding");

    append(getValue("系统编码", s));

    s = System.getProperty("microedition.locale");

    append(getValue("区域设置", s));

    s = System.getProperty("microedition.jtwi.version");

    append(getValue("JTWI", s));

    //判断是否支持MMAPI

    s = System.getProperty("microedition.media.version");

    append(getValue("MMAPI", s));

    //判断是否支持WMA

    s = System.getProperty("wireless.messaging.sms.smsc");

    if(s!=null) {

    append(getValue("WMA", "支持"));

    append(getValue("SMS", s));

    s = System.getProperty("wireless.messaging.mms.mmsc");

    append(getValue("MMS", s));

    } else

    append(getValue("WMA", null));

    //判断是否支持蓝牙

    s = System.getProperty("bluetooth.api.version");

    append(getValue("蓝牙", s));

    //判断是否支持个人信息管理

    s = System.getProperty("microedition.pim.version");

    append(getValue("PIM", s));

    //判断是否支持文件系统

    s=System.getProperty("microedition.io.file.FileConnection. version");

    append(getValue("FileConnection", s));

    //判断是否支持SIP

    s = System.getProperty("microedition.sip.version");

    append(getValue("SIP", s));

    //判断是否支持M3G JSR 184

    s = System.getProperty("microedition.m3g.version");

    append(getValue("M3G", s));

    addCommand(exit);

    setCommandListener(this);

    }

    private String getValue(String prompt, String s) {

    return prompt + ":" + (s==null ? "不支持" : s) + "\n";

    }

    public void commandAction(Command c, Displayable d) {

    if(c==exit){

    DetectMIDlet.quitApp();

    }

    }

    }

    DetectMIDlet的运行界面如图2-19所示。

    图2-19 DetectMIDlet的运行界面


    这篇文章只是整理这方面的知识,并不是原创。所以大家凑合着看吧


     

    发表于 @ 2007年08月30日 19:35:00|评论(loading...)|编辑

    新一篇: J2ME Polish 全攻略之入门 | 旧一篇: 深入分析J2ME平台MIDP低级事件处理机制

    评论:没有评论。

    发表评论  


    登录
    Csdn Blog version 3.1a
    Copyright © 无花