??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲成人资源网,欧美一区二区久久久,尤物视频免费在线观看http://www.aygfsteel.com/Ferrari4000/闯荡在移动互联网的世界中zh-cnMon, 05 May 2025 19:58:23 GMTMon, 05 May 2025 19:58:23 GMT60Ud互联|时?-Android上的一个例?/title><link>http://www.aygfsteel.com/Ferrari4000/archive/2009/03/14/259729.html</link><dc:creator>勤劳的蜜?/dc:creator><author>勤劳的蜜?/author><pubDate>Sat, 14 Mar 2009 08:16:00 GMT</pubDate><guid>http://www.aygfsteel.com/Ferrari4000/archive/2009/03/14/259729.html</guid><wfw:comment>http://www.aygfsteel.com/Ferrari4000/comments/259729.html</wfw:comment><comments>http://www.aygfsteel.com/Ferrari4000/archive/2009/03/14/259729.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Ferrari4000/comments/commentRss/259729.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Ferrari4000/services/trackbacks/259729.html</trackback:ping><description><![CDATA[<p>我们来演CZ个获取联pMhQƈ用网展现出来的单例子?/p> <p> 首先Q我们在eclipse环境中创Z个Android projectQ我们的Activity名称是com.example.RIAExampleQƈ且修改界面的layout文g如下Q?br /> </p> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #0000ff"><?</span><span style="color: #ff00ff">xml version="1.0" encoding="utf-8"</span><span style="color: #0000ff">?></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">LinearLayout </span><span style="color: #ff0000">xmlns:android</span><span style="color: #0000ff">="http://schemas.android.com/apk/res/android"</span><span style="color: #ff0000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />    android:orientation</span><span style="color: #0000ff">="vertical"</span><span style="color: #ff0000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />    android:layout_width</span><span style="color: #0000ff">="fill_parent"</span><span style="color: #ff0000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />    android:layout_height</span><span style="color: #0000ff">="fill_parent"</span><span style="color: #ff0000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="color: #0000ff">></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">WebView </span><span style="color: #ff0000">android:id</span><span style="color: #0000ff">="@+id/web"</span><span style="color: #ff0000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> android:layout_width</span><span style="color: #0000ff">="fill_parent"</span><span style="color: #ff0000"> android:layout_height</span><span style="color: #0000ff">="fill_parent"</span><span style="color: #0000ff">></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"></</span><span style="color: #800000">WebView</span><span style="color: #0000ff">></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"></</span><span style="color: #800000">LinearLayout</span><span style="color: #0000ff">></span></div> <p>可以看到Q界面中仅仅包含一个WebView控g?/p> <p> 接下来,创徏一个简单的javacL描述一个联pMh的信息,它包含联pMh姓名和号码?/p> <p> </p> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #0000ff">package</span><span style="color: #000000"> com.example;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.Vector;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> android.app.Activity;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> android.os.Bundle;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> android.webkit.WebView;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><br /> <img id="Codehighlighter1_176_1691_Open_Image" onclick="this.style.display='none'; Codehighlighter1_176_1691_Open_Text.style.display='none'; Codehighlighter1_176_1691_Closed_Image.style.display='inline'; Codehighlighter1_176_1691_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_176_1691_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_176_1691_Closed_Text.style.display='none'; Codehighlighter1_176_1691_Open_Image.style.display='inline'; Codehighlighter1_176_1691_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> RIAExample </span><span style="color: #0000ff">extends</span><span style="color: #000000"> Activity </span><span id="Codehighlighter1_176_1691_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_176_1691_Open_Text"><span style="color: #000000">{<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="color: #0000ff">private</span><span style="color: #000000"> WebView web;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="color: #008000">//</span><span style="color: #008000">模拟L?/span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">    </span><span style="color: #0000ff">private</span><span style="color: #000000"> Vector</span><span style="color: #000000"><</span><span style="color: #000000">Person</span><span style="color: #000000">></span><span style="color: #000000"> phonebook </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> Vector</span><span style="color: #000000"><</span><span style="color: #000000">Person</span><span style="color: #000000">></span><span style="color: #000000">();<br /> <img id="Codehighlighter1_275_323_Open_Image" onclick="this.style.display='none'; Codehighlighter1_275_323_Open_Text.style.display='none'; Codehighlighter1_275_323_Closed_Image.style.display='inline'; Codehighlighter1_275_323_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_275_323_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_275_323_Closed_Text.style.display='none'; Codehighlighter1_275_323_Open_Image.style.display='inline'; Codehighlighter1_275_323_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span id="Codehighlighter1_275_323_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/** */</span><span id="Codehighlighter1_275_323_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"> Called when the activity is first created. </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    @Override<br /> <img id="Codehighlighter1_391_859_Open_Image" onclick="this.style.display='none'; Codehighlighter1_391_859_Open_Text.style.display='none'; Codehighlighter1_391_859_Closed_Image.style.display='inline'; Codehighlighter1_391_859_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_391_859_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_391_859_Closed_Text.style.display='none'; Codehighlighter1_391_859_Open_Image.style.display='inline'; Codehighlighter1_391_859_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> onCreate(Bundle savedInstanceState) </span><span id="Codehighlighter1_391_859_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_391_859_Open_Text"><span style="color: #000000">{<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: #0000ff">super</span><span style="color: #000000">.onCreate(savedInstanceState);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        setContentView(R.layout.main);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: #0000ff">this</span><span style="color: #000000">.initContacts();<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        web </span><span style="color: #000000">=</span><span style="color: #000000"> (WebView)</span><span style="color: #0000ff">this</span><span style="color: #000000">.findViewById(R.id.web);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        web.getSettings().setJavaScriptEnabled(</span><span style="color: #0000ff">true</span><span style="color: #000000">);</span><span style="color: #008000">//</span><span style="color: #008000">开启javascript讄Q否则WebView不执行js脚本</span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">        web.addJavascriptInterface(</span><span style="color: #0000ff">this</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">phonebook</span><span style="color: #000000">"</span><span style="color: #000000">);</span><span style="color: #008000">//</span><span style="color: #008000">把RIAExample的一个实例添加到js的全局对象window中,<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />                                                        </span><span style="color: #008000">//</span><span style="color: #008000">q样可以用window.phonebook来调用它的方?/span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">        web.loadUrl(</span><span style="color: #000000">"</span><span style="color: #000000">file:///android_asset/phonebook.html</span><span style="color: #000000">"</span><span style="color: #000000">);</span><span style="color: #008000">//</span><span style="color: #008000">加蝲|页</span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">     <br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /> <img id="Codehighlighter1_870_997_Open_Image" onclick="this.style.display='none'; Codehighlighter1_870_997_Open_Text.style.display='none'; Codehighlighter1_870_997_Closed_Image.style.display='inline'; Codehighlighter1_870_997_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_870_997_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_870_997_Closed_Text.style.display='none'; Codehighlighter1_870_997_Open_Image.style.display='inline'; Codehighlighter1_870_997_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span id="Codehighlighter1_870_997_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/** */</span><span id="Codehighlighter1_870_997_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />     * 该方法将在js脚本中,通过window.phonebook.getContacts()q行调用<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />     * q回的JavaArrayJSWrapper对象可以使得在js中访问Java数组<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />     * </span><span style="color: #808080">@return</span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />     </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /> <img id="Codehighlighter1_1042_1232_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1042_1232_Open_Text.style.display='none'; Codehighlighter1_1042_1232_Closed_Image.style.display='inline'; Codehighlighter1_1042_1232_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1042_1232_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1042_1232_Closed_Text.style.display='none'; Codehighlighter1_1042_1232_Open_Image.style.display='inline'; Codehighlighter1_1042_1232_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> JavaArrayJSWrapper getContacts()</span><span id="Codehighlighter1_1042_1232_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_1042_1232_Open_Text"><span style="color: #000000">{<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">fetching contacts data</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        Person[] a </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> Person[</span><span style="color: #0000ff">this</span><span style="color: #000000">.phonebook.size()];<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        a </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">this</span><span style="color: #000000">.phonebook.toArray(a);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> JavaArrayJSWrapper(a);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /> <img id="Codehighlighter1_1243_1269_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1243_1269_Open_Text.style.display='none'; Codehighlighter1_1243_1269_Closed_Image.style.display='inline'; Codehighlighter1_1243_1269_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1243_1269_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1243_1269_Closed_Text.style.display='none'; Codehighlighter1_1243_1269_Open_Image.style.display='inline'; Codehighlighter1_1243_1269_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span id="Codehighlighter1_1243_1269_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/** */</span><span id="Codehighlighter1_1243_1269_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />     * 初始化电话号码簿<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />     </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /> <img id="Codehighlighter1_1301_1522_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1301_1522_Open_Text.style.display='none'; Codehighlighter1_1301_1522_Closed_Image.style.display='inline'; Codehighlighter1_1301_1522_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1301_1522_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1301_1522_Closed_Text.style.display='none'; Codehighlighter1_1301_1522_Open_Image.style.display='inline'; Codehighlighter1_1301_1522_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> initContacts()</span><span id="Codehighlighter1_1301_1522_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_1301_1522_Open_Text"><span style="color: #000000">{<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        Person p </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> Person();<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        p.name </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000">Perter</span><span style="color: #000000">"</span><span style="color: #000000">;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        p.phone_number </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000">8888888</span><span style="color: #000000">"</span><span style="color: #000000">;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        phonebook.add(p);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        p </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> Person();<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        p.name </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000">Jack</span><span style="color: #000000">"</span><span style="color: #000000">;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        p.phone_number </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000">777777</span><span style="color: #000000">"</span><span style="color: #000000">;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        phonebook.add(p);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       <br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /> <img id="Codehighlighter1_1533_1607_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1533_1607_Open_Text.style.display='none'; Codehighlighter1_1533_1607_Closed_Image.style.display='inline'; Codehighlighter1_1533_1607_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1533_1607_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1533_1607_Closed_Text.style.display='none'; Codehighlighter1_1533_1607_Open_Image.style.display='inline'; Codehighlighter1_1533_1607_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span id="Codehighlighter1_1533_1607_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/** */</span><span id="Codehighlighter1_1533_1607_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />     * 通过window.phonebook.debugout来输出js调试信息?br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />     * </span><span style="color: #808080">@param</span><span style="color: #008000"> info<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />     </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /> <img id="Codehighlighter1_1646_1689_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1646_1689_Open_Text.style.display='none'; Codehighlighter1_1646_1689_Closed_Image.style.display='inline'; Codehighlighter1_1646_1689_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1646_1689_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1646_1689_Closed_Text.style.display='none'; Codehighlighter1_1646_1689_Open_Image.style.display='inline'; Codehighlighter1_1646_1689_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> debugout(String info)</span><span id="Codehighlighter1_1646_1689_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_1646_1689_Open_Text"><span style="color: #000000">{<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        System.out.println(info);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div> <br /> 下面是html文gQ它非常单?br /> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #0000ff"><</span><span style="color: #800000">html</span><span style="color: #0000ff">></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="color: #0000ff"><</span><span style="color: #800000">head</span><span style="color: #0000ff">></span><span style="color: #000000"><br /> <img id="Codehighlighter1_72_161_Open_Image" onclick="this.style.display='none'; Codehighlighter1_72_161_Open_Text.style.display='none'; Codehighlighter1_72_161_Closed_Image.style.display='inline'; Codehighlighter1_72_161_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_72_161_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_72_161_Closed_Text.style.display='none'; Codehighlighter1_72_161_Open_Image.style.display='inline'; Codehighlighter1_72_161_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />        </span><span style="color: #0000ff"><</span><span style="color: #800000">script </span><span style="color: #ff0000">type</span><span style="color: #0000ff">="text/javascript"</span><span style="color: #ff0000"> src</span><span style="color: #0000ff">="fetchcontacts.js"</span><span style="color: #0000ff">/></span><span id="Codehighlighter1_72_161_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_72_161_Open_Text"><span style="color: #000000; background-color: #f5f5f5"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000; background-color: #f5f5f5"></</span><span style="color: #000000; background-color: #f5f5f5">head</span><span style="color: #000000; background-color: #f5f5f5">></span><span style="color: #000000; background-color: #f5f5f5"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000; background-color: #f5f5f5"><</span><span style="color: #000000; background-color: #f5f5f5">body</span><span style="color: #000000; background-color: #f5f5f5">></span><span style="color: #000000; background-color: #f5f5f5"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="color: #000000; background-color: #f5f5f5"><</span><span style="color: #000000; background-color: #f5f5f5">div id </span><span style="color: #000000; background-color: #f5f5f5">=</span><span style="color: #000000; background-color: #f5f5f5"> </span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">contacts</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">></span><span style="color: #000000; background-color: #f5f5f5"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: #000000; background-color: #f5f5f5"><</span><span style="color: #000000; background-color: #f5f5f5">p</span><span style="color: #000000; background-color: #f5f5f5">></span><span style="color: #000000; background-color: #f5f5f5"> </span><span style="color: #0000ff; background-color: #f5f5f5">this</span><span style="color: #000000; background-color: #f5f5f5"> is a demo </span><span style="color: #000000; background-color: #f5f5f5"></</span><span style="color: #000000; background-color: #f5f5f5">p</span><span style="color: #000000; background-color: #f5f5f5">></span><span style="color: #000000; background-color: #f5f5f5"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="color: #000000; background-color: #f5f5f5"></</span><span style="color: #000000; background-color: #f5f5f5">div</span><span style="color: #000000; background-color: #f5f5f5">></span><span style="color: #000000; background-color: #f5f5f5"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000; background-color: #f5f5f5"></</span><span style="color: #000000; background-color: #f5f5f5">body</span><span style="color: #000000; background-color: #f5f5f5">></span><span style="color: #000000; background-color: #f5f5f5"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000; background-color: #f5f5f5"></</span><span style="color: #000000; background-color: #f5f5f5">html</span><span style="color: #000000; background-color: #f5f5f5">></span><span style="color: #000000; background-color: #f5f5f5"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span></div> </span><br /> 而主角就是我们的javascript脚本fetchcontacts.js<br /> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img id="Codehighlighter1_25_821_Open_Image" onclick="this.style.display='none'; Codehighlighter1_25_821_Open_Text.style.display='none'; Codehighlighter1_25_821_Closed_Image.style.display='inline'; Codehighlighter1_25_821_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_25_821_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_25_821_Closed_Text.style.display='none'; Codehighlighter1_25_821_Open_Image.style.display='inline'; Codehighlighter1_25_821_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="color: #000000">window.onload</span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">function</span><span style="color: #000000">()</span><span id="Codehighlighter1_25_821_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_25_821_Open_Text"><span style="color: #000000">{<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    window.phonebook.debugout(</span><span style="color: #000000">"</span><span style="color: #000000">inside js onload</span><span style="color: #000000">"</span><span style="color: #000000">);</span><span style="color: #008000">//</span><span style="color: #008000">调用RIAExample.debugout</span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">    </span><span style="color: #0000ff">var</span><span style="color: #000000"> persons </span><span style="color: #000000">=</span><span style="color: #000000"> window.phonebook.getContacts();</span><span style="color: #008000">//</span><span style="color: #008000">调用RIAExample.getContacts()</span><span style="color: #008000"><br /> <img id="Codehighlighter1_185_756_Open_Image" onclick="this.style.display='none'; Codehighlighter1_185_756_Open_Text.style.display='none'; Codehighlighter1_185_756_Closed_Image.style.display='inline'; Codehighlighter1_185_756_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_185_756_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_185_756_Closed_Text.style.display='none'; Codehighlighter1_185_756_Open_Image.style.display='inline'; Codehighlighter1_185_756_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #000000">    </span><span style="color: #0000ff">if</span><span style="color: #000000">(persons)</span><span id="Codehighlighter1_185_756_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_185_756_Open_Text"><span style="color: #000000">{</span><span style="color: #008000">//</span><span style="color: #008000">persons实际上是JavaArrayJSWrapper对象</span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">        window.phonebook.debugout(persons.length() </span><span style="color: #000000">+</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000"> of contact entries are fetched</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: #0000ff">var</span><span style="color: #000000"> contactsE </span><span style="color: #000000">=</span><span style="color: #000000"> document.getElementById(</span><span style="color: #000000">"</span><span style="color: #000000">contacts</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: #0000ff">var</span><span style="color: #000000"> i </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">; <br /> <img id="Codehighlighter1_401_753_Open_Image" onclick="this.style.display='none'; Codehighlighter1_401_753_Open_Text.style.display='none'; Codehighlighter1_401_753_Closed_Image.style.display='inline'; Codehighlighter1_401_753_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_401_753_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_401_753_Closed_Text.style.display='none'; Codehighlighter1_401_753_Open_Image.style.display='inline'; Codehighlighter1_401_753_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span style="color: #0000ff">while</span><span style="color: #000000">(i </span><span style="color: #000000"><</span><span style="color: #000000"> persons.length())</span><span id="Codehighlighter1_401_753_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_401_753_Open_Text"><span style="color: #000000">{</span><span style="color: #008000">//</span><span style="color: #008000">persons.length()调用JavaArrayJSWrapper.length()Ҏ</span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">            <br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />            pnode </span><span style="color: #000000">=</span><span style="color: #000000"> document.createElement(</span><span style="color: #000000">"</span><span style="color: #000000">p</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />            tnode </span><span style="color: #000000">=</span><span style="color: #000000"> document.createTextNode(</span><span style="color: #000000">"</span><span style="color: #000000">name : </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> persons.get(i).getName() </span><span style="color: #000000">+</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000"> number : </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> persons.get(i).getNumber());</span><span style="color: #008000">//</span><span style="color: #008000">persons.get(i)获得Person对象Q然后在js里面直接调用getName()和getNumber()获取姓名和号?/span><span style="color: #008000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">            pnode.appendChild(tnode);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />            contactsE.appendChild(pnode);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />            i </span><span style="color: #000000">++</span><span style="color: #000000">;<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="color: #000000"><br /> <img id="Codehighlighter1_761_817_Open_Image" onclick="this.style.display='none'; Codehighlighter1_761_817_Open_Text.style.display='none'; Codehighlighter1_761_817_Closed_Image.style.display='inline'; Codehighlighter1_761_817_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_761_817_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_761_817_Closed_Text.style.display='none'; Codehighlighter1_761_817_Open_Image.style.display='inline'; Codehighlighter1_761_817_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    }</span></span><span style="color: #0000ff">else</span><span id="Codehighlighter1_761_817_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_761_817_Open_Text"><span style="color: #000000">{<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        window.phonebook.debugout(</span><span style="color: #000000">"</span><span style="color: #000000">persons is undefined</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: #000000"><br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /> <img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div> <p><br />  例子很简单,我加了注释希望有助大家理解,其他我就不深入解释了?br /> 我把例子的源代码放上来,你可以下来试一试?br /> <br /> </p> <p><a title="RIADemo" href="http://www.aygfsteel.com/Files/Ferrari4000/RIADemo.tar">RIADemo</a></p> <p>q个例子说明通过WebView.addJavascriptInterfaceҎQ我们可以扩展JavaScript的APIQ获取Android的数据。这PJS的粉丝就可以使用DojoQJQueryQPrototy{这些知名的js框架来搭建android应用E序来展现它们很酷很玄的效果Q但是,目前addJavascriptInterfaceq不够灵zd大,Z么呢Q敬请关注第四篇“what next?”<br /> <br /> <br /> </p> <img src ="http://www.aygfsteel.com/Ferrari4000/aggbug/259729.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Ferrari4000/" target="_blank">勤劳的蜜?/a> 2009-03-14 16:16 <a href="http://www.aygfsteel.com/Ferrari4000/archive/2009/03/14/259729.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ud互联|时?-忽如一夜春风来Qweb花开各终?/title><link>http://www.aygfsteel.com/Ferrari4000/archive/2009/03/10/258930.html</link><dc:creator>勤劳的蜜?/dc:creator><author>勤劳的蜜?/author><pubDate>Tue, 10 Mar 2009 14:39:00 GMT</pubDate><guid>http://www.aygfsteel.com/Ferrari4000/archive/2009/03/10/258930.html</guid><wfw:comment>http://www.aygfsteel.com/Ferrari4000/comments/258930.html</wfw:comment><comments>http://www.aygfsteel.com/Ferrari4000/archive/2009/03/10/258930.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Ferrari4000/comments/commentRss/258930.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Ferrari4000/services/trackbacks/258930.html</trackback:ping><description><![CDATA[<div><span id="wmqeeuq" class="Apple-tab-span" style="white-space:pre"> </span>自从Apple在safari上用webkitq移植到iphone后,webkit׃佛是获得了选秀W一名似的,吸引了众多眼球?/div> <div><span id="wmqeeuq" class="Apple-tab-span" style="white-space:pre"> </span>其实Q我最早听说webkit是在iphone出来前一两年Q当时有报道说Nokia正在采用webkit为它下一代的Symbianq_做一个引擎,而且q有专门的社区,但比较封闭,很难q入那个圈子Q让ZҎ觉没有。不q,臛_说明Nokia很早q上这一块了?/div> <div><span id="wmqeeuq" class="Apple-tab-span" style="white-space:pre"> </span>iphone发布后,Appleg接webkit了,从此QwebkitC֌有了巨大变化。Apple把能开攄东西都放CwebkitC֌里面Q速度q相当的快(用Apple自己的话_他们贡献?1%的力量,看看webkitC֌的主力开发h员,有多来自AppleQ)现在Q我们时不时的可以看到webkit的更斎ͼ比如对html5的跟q,css的特效等新功能!其中不得不重Ҏ出的?008q??日,webkitC֌发布了高性能javascript引擎SquirrelFishQ??日google chrome发布Q采用了V8 javascript引擎Q号U比SquirrelFishq快Q两个礼拜后webkit发布了SquirrelFish Extremel予正面q击。巨头们牟了劲争先把javascript引擎沚wt到底!我不想猜他们卖力的真正原因Q但是,我觉得随着Udl端能力加强Qjavascript大面U攻q终端已l指日可待了Qiphone和android已经实现了?/div> <div><span id="wmqeeuq" class="Apple-tab-span" style="white-space:pre"> </span>q期_׃Apple的快速组合拳QNokial营的webkit专区很快倒闭了。但他ƈ没有攑ּ对webkit的投入,2008q??8日Nokia宣布收购了Trolltech公司。现在Trolltech lab作ؓNokia的代表仍然活跃在webkitC֌之中。就前两天,他们q在http://planet.webkit.org/发布了一标题极其引人的博文“Creating a Google chat client in 15 minutes”QؓQWebView做了一把广告,怿qt的粉丝肯定不会错q。而本月初发布的qt4.5中,明确指出qt加强了对webkit诸如SquirrelFish{新功能的整合。那么就让我们期待一下Nokia的新ƾ机器吧?/div> <div><span id="wmqeeuq" class="Apple-tab-span" style="white-space:pre"> </span>到此Q我们已l看到Google, Apple, Nokia, Palm{移动终端的领头们所采取的行动,然而,不要忘记软g厂商QAdobe是杰出的代表。作为RIA的强烈倡导者,他也选择把webkit整合到其AIRq_Q你可以惌q个webkit+flash的威力有多强大!而Adobe发v的openscreen目Q更是表明了他要在RIA上争夺王位的野心Q?/div> <div><span id="wmqeeuq" class="Apple-tab-span" style="white-space:pre"> </span>好了Q不啰嗦那么多了QM呢,webkit已经成ؓUd互联|这出大戏的主角了,回归到我在上一中提到的主题,让我们来研究一下android.webkit.WebView的功能,来看android上的RIA?/div> <div><span id="wmqeeuq" class="Apple-tab-span" style="white-space:pre"> </span>敬请x下一?-使用WebView的小例子?/div> <div><br /> </div> <img src ="http://www.aygfsteel.com/Ferrari4000/aggbug/258930.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Ferrari4000/" target="_blank">勤劳的蜜?/a> 2009-03-10 22:39 <a href="http://www.aygfsteel.com/Ferrari4000/archive/2009/03/10/258930.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ud互联|时代的l端--暂时遗忘OSGiQ让我们d味一杯android出的移动互联网咖啡?/title><link>http://www.aygfsteel.com/Ferrari4000/archive/2009/03/09/258689.html</link><dc:creator>勤劳的蜜?/dc:creator><author>勤劳的蜜?/author><pubDate>Mon, 09 Mar 2009 14:53:00 GMT</pubDate><guid>http://www.aygfsteel.com/Ferrari4000/archive/2009/03/09/258689.html</guid><wfw:comment>http://www.aygfsteel.com/Ferrari4000/comments/258689.html</wfw:comment><comments>http://www.aygfsteel.com/Ferrari4000/archive/2009/03/09/258689.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Ferrari4000/comments/commentRss/258689.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Ferrari4000/services/trackbacks/258689.html</trackback:ping><description><![CDATA[<div>1q多前,揣着在移动终端推qOSGi的梦惻I我离开了原来的公司Q来C一个自认ؓ更利于osgi的地方,在我看来osgi拥有eRCPq样的粉丝,应该会给它在Udl端上提供广阔的舞台。然而半路杀ZE咬金,google androidQ第一ơ见到它Ӟ我不怿osgi会输Q于是就废寝忘食的研I它Q结果我没有q行太多的抵抗,很快pAndroid收编了。我得承认它在某些关键的因素Q确实比osgi更适合Udl端。对此,我只能感叹google开源的伟大Q以及摒弃jcp的雷厉风行!但是Q更为重要的是,在移动互联网时代卛_到来的时刻,Android为我们打开了一扇方便之门,q到底ؓ何?</div> <div><br /> </div> <div>通过对Android的(javaQ源码进行扫描后Q我看到了像jsr211QMVMq些老朋友的影子Q嗯Q我可不惛_炒这些旧饭了。还有啥Q网上热炒android用了webkit作ؓ其浏览器的引擎,和iphone的safari使用的引擎一Pq个东西应该不错Q因为我一直觉得eRCP没有很好的web控gQ得它在移动^C逊色不少Q于是我d了android.webkitq个java包,wow! Googlelwebkit装了很多java的接口,q真是java开发h员的气Q(听说很多java开发h员对sun的javafx期待度最高的是一个传说中的JWebView控gQ但是不知道出来没,了Q我懒得查证了,因ؓ俺现在不x费太多在sun java上,呵呵Q,不过我觉得这更是q大互联|应用开发h员的气Q想惻I用html + css + javascriptp~写android的类似电话簿Q日历甚x机桌面的应用Q这N不让您Q惌吗Q所以,如果说Android为移动终端进入互联网开了一扇门Q那么android.webkit.WebView是q扇门的金钥匙,而webkit是通向互联|的康庄大道Q?/div> <div><br /> </div> <div>其实android的webview是一个极端复杂的控gQ而我个h认ؓ它是可以实现现在热炒的RIA/webos{概늚基石Q虽然我q入q个领域不长Q但觉得它非常有意思,很有前途,所以我打算写一个系列,分n对它的理解,强烈Ƣ迎各位高手指点Q?/div> <div><br /> </div> <div>怎么开始说呢?不知道大家有没有注意Q年初Palm公司在CES上palm pre的基于webkit的webos惊艳之秀Q十x起了大家的胃口,q是我听到第一个冠以webos的移动终端,q是不是意味着目前由palm来唱q个webos的独角戏呢?{案当然不是Q其实很多终端厂家以及^台厂商很早就率领大部队兵临webos的城下了Q相信很快一场硝烟I漫的战争p开始了......</div> <div><br /> </div> <div>Ʋ知端的Q敬请关注移本系列第二篇--忽如一夜春风来Qweb花开各终?/div> <img src ="http://www.aygfsteel.com/Ferrari4000/aggbug/258689.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Ferrari4000/" target="_blank">勤劳的蜜?/a> 2009-03-09 22:53 <a href="http://www.aygfsteel.com/Ferrari4000/archive/2009/03/09/258689.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>OSGi介绍Q七Qbundle和service(l?http://www.aygfsteel.com/Ferrari4000/archive/2007/07/21/131670.html勤劳的蜜?/dc:creator>勤劳的蜜?/author>Sat, 21 Jul 2007 14:28:00 GMThttp://www.aygfsteel.com/Ferrari4000/archive/2007/07/21/131670.htmlhttp://www.aygfsteel.com/Ferrari4000/comments/131670.htmlhttp://www.aygfsteel.com/Ferrari4000/archive/2007/07/21/131670.html#Feedback1http://www.aygfsteel.com/Ferrari4000/comments/commentRss/131670.htmlhttp://www.aygfsteel.com/Ferrari4000/services/trackbacks/131670.html接上一的例子Qؓ了更具体一点,我们考虑q样的case,
假设房地产开发商construction A采纳了规划公司design A的方案,打算建造公寓类型的房子CityApartment
然后客户AC一套房?/p>

用ooa方式分析q个caseQ?br>我抽象这几个实体Q规划公司,囄cdQ开发商Q房子,买房?br>然后描述q几件事情:开发商选择设计囄Q盖楼然后销售;买房人根据图U怹房ƈ使用房子

下面是我用java语言来简单描q它Q?/p>

design A 公司

package design.a;
interface Apartment {
..
//Ҏ省略?/span>
}

 

开发商construction A

package construction.a

import design.a.*;//开发商要按照图U盖?/span>

class CityApartment implements Apartment {
.
//Ҏ省略?/span>
}


class Construction implements BundleActivator{

}



客户 costumer A

package customer.a

import design.a.*;//客户要按照图UR择房子

class Customer implements BundleActivator {
.
//Ҏ省略?/span>
}



然后我们把他们分别做成bundle
Bundle A : design A
其manifest中这hq?br>

BundleSymbolicName: design A
Export
-Package: design.a


Bundle B : construction A
其manifest中这hq?/p>

BundleSymbolicName: construction A
Import
-Package: design.a
Bundle
-Activator: construction.a.Construction


Bundle C : customer C
其manifest中这hq?/p>

BundleSymbolicName: customer C
Import
-Package: design.a
Bundle
-Activator: customer.c.Customer



q样Q装入到framework后,framework׃把BundlB和C与BundleA兌hQ正好描q开发商A选择design A的图U,客户A也不得不选择design A的图U啦
可是Q单从这里,我们看不出来Q开发商和客h同一份图U干什么。那我们得必dBundleB和C的实现里面写点东西来说明?/p>

q里l出开发商construction.a.Construction的伪代码Q?/p>

class Construction implements BundleActivator {

 
public void start(BundleContext context){
  CityApartment apartment 
= null;
  Hashtable properties 
= null;
  
for(int i = 0; i < 100; i ++){
   properties 
= new Hashtable();
   properties.put(
"price",new Integer(1000 + i*5));//开发商为房子定?/span>
   apartment = new CityApartment();//一套房子盖?br>   //把房子按照公寓注册出dƈ打广告,{待客户来购乎ͼframeworkq当于一个售楼处兼房屋中?/span>
   context.registerService(Apartment.class.getName()/*公寓cd*/,apartment/*房子作ؓ服务对象*/,properties/*与房子相关的附带信息*/);
   
  }

  
//q样开发商一共注册一癑֥房子
 }

}



而客L代码可以如下Q?/p>

class Customer implements BundleActivator {
 
public void start(BundleContext context){
  Apartment apartment 
= null;
  ServiceReference ref 
= context.getServiceReference(Apartment.class.getName,"(price=1050)");//先签|购房合同,而且指明选择Apartmentcd,h?050的房子?/span>
  apartment = (Apartment)context.getService(ref);//然后买到房子
  
//买房人就可以使用房子apartment对象q行日常生活?/span>
 }

}


q样Q我们就很清楚的看出QDesign A为Construction A和Customer A提供了共同的Apartment定义Q才使得他们有交易的可能。于此同ӞConstruction A和Customer A之间的耦合是非常松的,因ؓQ如果有另外一个开发商onstruction B加入q来也构造了Apartment的对象,Customer可以通过改变选择条gQ轻易的获得B的房子,而客hw不兛_房子是Aq是B盖的Q这个是典型的面向对象的多态应用?/p>

ȝ说来QBundle在framework的帮助下Q得其他bundle使用其类型定义成为可能。service是在这些共享的cd定义基础上生的具体对象Q而用这些service对象的bundleQ必然也是对应共享类型的使用者?br>q种cd׃nQ在osgi里面叫做"class space". frameworkq行旉过兌bundle之间的类型定义,可以构成一个或多个"class space"Q而某个bundle在framework里面Q只能处在一?class space"里面Q不能同时出现在多个"class space"中?br>怎么理解q个话呢Q请看下一,外星人入侵了?/p>

 



]]>
OSGi 介绍Q七Qbundle和service的关p?/title><link>http://www.aygfsteel.com/Ferrari4000/archive/2007/07/16/130692.html</link><dc:creator>勤劳的蜜?/dc:creator><author>勤劳的蜜?/author><pubDate>Mon, 16 Jul 2007 15:31:00 GMT</pubDate><guid>http://www.aygfsteel.com/Ferrari4000/archive/2007/07/16/130692.html</guid><wfw:comment>http://www.aygfsteel.com/Ferrari4000/comments/130692.html</wfw:comment><comments>http://www.aygfsteel.com/Ferrari4000/archive/2007/07/16/130692.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Ferrari4000/comments/commentRss/130692.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Ferrari4000/services/trackbacks/130692.html</trackback:ping><description><![CDATA[<p>osgipd已经发表了有近2q的旉了,很高兴这期间得到了许多朋友的xQ你们和我的讨论切磋都让我兴奋无比。而过d长的旉里,׃灉|枯竭外加_֊有限Q不能给大家分n更多osgi的精彩,实在辜负大家的期望,q请谅解。不q,Ҏq段旉大家和我U下的讨论,发现很多人都苦恼于分不清楚bundle和service的关p,而我的osgi 5-6又臭又长Q而且q非怾赖技术,实在是坑宛_门者的必备武器。这个不I犹如头上方圆半尺盘旋的苍蝇,困扰着我,解释的邮件也不知写多,估计收效甚微。于是我军_再次出山Q写一个惊世骇俗的分析文章Q力图让更多读者都能够把这两个疯马牛理清楚?/p> <p>开讲之前,q是用老办法,l大家D个例子。放心,q个例子一炚w不技术,而且我相信你可能比我q清楚。大安知道房地产商是怎么q作楼盘的吧。据我浅昄认识Q他们都会先q行一些图U怸的规划,里面包含区的整体规模,楼房外观以及q大疾苦民众最为关心和渴求的户型图。据_很多房地产商在搞定政府某些关键部门(个h意见仅供参考)拿到一块地后,Ҏ不用费心思去自己规划q些自己都一H不通的东西Q只要请一个有资质的第三方公司写写ȝQ甚至照搬某西方发达国家的某C֌概念Q冠于中国特色云云,p使广大民众趋之若鹜,們֛抢购。okQ你可能受不了我又愤世嫉俗了Q这个到底和osgi有啥关系Q别着急,天色已经很晚Q下ơ某个时间请l箋xosgi(?l,光Q请大家先考虑一下,如何用ooa的方式来描述Z如何购房Q以及在房子里进行日常生z这L单场景?/p> <img src ="http://www.aygfsteel.com/Ferrari4000/aggbug/130692.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Ferrari4000/" target="_blank">勤劳的蜜?/a> 2007-07-16 23:31 <a href="http://www.aygfsteel.com/Ferrari4000/archive/2007/07/16/130692.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>OSGi on mobile phone !http://www.aygfsteel.com/Ferrari4000/archive/2007/05/14/117256.html勤劳的蜜?/dc:creator>勤劳的蜜?/author>Mon, 14 May 2007 02:11:00 GMThttp://www.aygfsteel.com/Ferrari4000/archive/2007/05/14/117256.htmlhttp://www.aygfsteel.com/Ferrari4000/comments/117256.htmlhttp://www.aygfsteel.com/Ferrari4000/archive/2007/05/14/117256.html#Feedback0http://www.aygfsteel.com/Ferrari4000/comments/commentRss/117256.htmlhttp://www.aygfsteel.com/Ferrari4000/services/trackbacks/117256.html如果你一直关注osgi在embedded的发?q且q能到旧金山参加正在举行的java one,那我真是慕M?

Nokia在她的N800上demoq行了osgi(此消息来源于david beers对BJ在osgi alliance blog上的评论,关于demo可以看这个link http://thehereweb.googlepages.com/)
同时国q行商Sprint也宣布采用osgi的手机^台将会在q底面世.多么值得期待的事?



]]>
framework implementation updatedhttp://www.aygfsteel.com/Ferrari4000/archive/2006/09/16/70100.html勤劳的蜜?/dc:creator>勤劳的蜜?/author>Sat, 16 Sep 2006 15:40:00 GMThttp://www.aygfsteel.com/Ferrari4000/archive/2006/09/16/70100.htmlhttp://www.aygfsteel.com/Ferrari4000/comments/70100.htmlhttp://www.aygfsteel.com/Ferrari4000/archive/2006/09/16/70100.html#Feedback0http://www.aygfsteel.com/Ferrari4000/comments/commentRss/70100.htmlhttp://www.aygfsteel.com/Ferrari4000/services/trackbacks/70100.html瞎整了半q多Q克服了重重困难Q终于把原来framework做了更新Q如果有兴趣Q还可以按照原来的Link下蝲?br />framework下蝲后,解压q运行startframework.bat可以启动framework了?br />目前该framework只支持在内存中存储bundle.

另外Q多增加了一个管理bundleQ它为framework提供了简单的囑Ş化操作界面,可以在这里下载?/p>

http://www.aygfsteel.com/Files/Ferrari4000/bundlemanagement.zip

下蝲后,最好先把名字改为bundlemanagement.jar
然后可以q样安装Q假设该文g下蝲到d:\bundles下,则可以在framework的shell下输?br />in file:d:/bundles/bundlemanagement.jar
安装该bundleQ安装成功后输入stt 1Q注意:1是数字一Q,启动该bundle可以出现图形操作界面了?br />
囑Ş界面提供bundle的安装(只支持本地安装)Q启动,停止Q升U和删除{简单功能?br />其他功能会在后面陆箋增加。目前这个bundle只能q行在j2se环境下?br />
l的源代码没有很好的build文gQ等我有旉了,再写一个?br />
感谢毕嘉兄弟的支持,他帮助设计了bundle存储模块以及实现了bundle在内存存储的W一版?br />
有啥问题Q可以直接给我发邮gQ?a href="mailto:jerrylee.li@gmail.com">jerrylee.li@gmail.com



]]>
OSGi的曙光?http://www.aygfsteel.com/Ferrari4000/archive/2006/03/03/33453.html勤劳的蜜?/dc:creator>勤劳的蜜?/author>Fri, 03 Mar 2006 05:51:00 GMThttp://www.aygfsteel.com/Ferrari4000/archive/2006/03/03/33453.htmlhttp://www.aygfsteel.com/Ferrari4000/comments/33453.htmlhttp://www.aygfsteel.com/Ferrari4000/archive/2006/03/03/33453.html#Feedback1http://www.aygfsteel.com/Ferrari4000/comments/commentRss/33453.htmlhttp://www.aygfsteel.com/Ferrari4000/services/trackbacks/33453.htmlhttp://www.jcp.org/en/jsr/detail?id=291Q,
要把osgi的core应用到目前的j2se上,以填补jsr277发布前的需求空白?BR>
osgi?77的pk开始了Q我投osgi一,呵呵Q你买谁Q?BR>

]]>
OSGi Alliance开N向公众的邮g列表http://www.aygfsteel.com/Ferrari4000/archive/2006/02/16/30919.html勤劳的蜜?/dc:creator>勤劳的蜜?/author>Thu, 16 Feb 2006 02:20:00 GMThttp://www.aygfsteel.com/Ferrari4000/archive/2006/02/16/30919.htmlhttp://www.aygfsteel.com/Ferrari4000/comments/30919.htmlhttp://www.aygfsteel.com/Ferrari4000/archive/2006/02/16/30919.html#Feedback0http://www.aygfsteel.com/Ferrari4000/comments/commentRss/30919.htmlhttp://www.aygfsteel.com/Ferrari4000/services/trackbacks/30919.htmll开设Blog后(http://www.osgi.org/blog/index.htmlQ,昨天OSGi Alliance又宣布开设一个public的mail listQ每个对OSGi感兴的人都可以加入到这个列表中Q通过q个列表可以讯问OSGi的相关的各种问题以及订阅列表的邮件?BR>请到http://bundles.osgi.org/mailman/listinfo/osgi-devq里注册?BR>
下面是BJ Hargrave的代表OSGi Alliance发的announcement


Hello,

As part of the OSGi evangelism work, I would like to announce that OSGi now has a new public mail list for OSGi technical questions and discussion. This mail list is a public list and is open to anyone to participate. This new list is mainly for non-members to discuss OSGi technology and ask question about the technology. ......

The new mail list address is:

osgi-dev@bundles.osgi.org

You can subscribe to the list here:
http://bundles.osgi.org/mailman/listinfo/osgi-dev or by sending an e-mail to osgi-dev-subscribe@bundles.osgi.org.

So please go ahead and subscribe to the new osgi-dev mail list. Your participation there can help educate others about the OSGi technology.

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance



]]>
framework implementationhttp://www.aygfsteel.com/Ferrari4000/archive/2006/02/15/30737.html勤劳的蜜?/dc:creator>勤劳的蜜?/author>Wed, 15 Feb 2006 01:15:00 GMThttp://www.aygfsteel.com/Ferrari4000/archive/2006/02/15/30737.htmlhttp://www.aygfsteel.com/Ferrari4000/comments/30737.htmlhttp://www.aygfsteel.com/Ferrari4000/archive/2006/02/15/30737.html#Feedback8http://www.aygfsteel.com/Ferrari4000/comments/commentRss/30737.htmlhttp://www.aygfsteel.com/Ferrari4000/services/trackbacks/30737.htmlq里是我目前的成果?BR>http://www.aygfsteel.com/Files/Ferrari4000/framework.zip包含了framework的jar文g?BR>解压后,直接q行.bat文g可以了。这个framework实现了r4core的大部分apiQ除一些支持local和安全的外,secrurity admin和conditional permissionq两个服务也没有实现Qurl service也没有实玎ͼQ输入help可以看到可以q行的命令(不过全是英文的,q是我写的,就一下吧Q?BR>
http://www.aygfsteel.com/Files/Ferrari4000/src.zip包含所有源码。代码有点ؕQhoho

要成功编译代码,您还需要下载这?A HREF="/Files/Ferrari4000/osgi.rar">http://www.aygfsteel.com/Files/Ferrari4000/osgi.rar
解压q后得到4个jarQƈ把他们放入到build path中,import序保证它们优先于jre可以了?/STRONG>

我打重新编写了。把framework的实现重新规划一下,然后实现core的所有内容,q而再实现cmpn的所有服务?BR>如果你对开发osgi framework感兴,一h吧!

l我发信Q?A href="mailto:jerrylee.li@gmail.com">jerrylee.li@gmail.com



]]>
վ֩ģ壺 | | Ѯ| | Ű| ƾ| ף| | ͬ| ¡| ͨ| ɽʡ| | | ɽ| | ˮ| | | ˼é| | | | | ¡| ν| | | | | | ʢ| | ɽ| ˶| ɽ| | ʤ| ̩| | Թ|