|
||||||||
Home »風景写真 »茨城の風景 »D100の世界 »蕎麦三昧 »温泉三昧 »考える葦 »パンドラの箱 » | »HP内検索エンジン | |||||||
■ 携帯電話のGPS機能 Part4 SH903iのGPSのテスト!「iαppli Development Kit for DoJa-5.0(FOMA)」は、i モード携帯電話で動作するJava アプリケーション(iアプリ)の開発をサポートしてくれています。 ですから、iアプリをiモード携帯電話で動作させるには、次のものを作れば良いのです。: • iアプリの Jar ファイル • アプリケーションディスクリプタファイル(ADF) • iアプリをダウンロードするためのHTMLファイル これらは、すべてエミュレータで簡単に作成することができます。 と、マニュアルには書かれているのですが、本当かな? まずは、iアプリのJarファイルを作らないと! エミュレータを起動して、ソースファイルの作成が必要です。 この時、使用するリスナで、使いたいリスナにチェックを付けます。 • ソフトキーリスナ ・・・ ソフトキーを扱う場合 • キーリスナ ・・・ キーを扱う場合 • コンポーネントリスナ・・・ ボタンなどのコンポーネントを扱う場合 • メディアリスナ ・・・ 動画像や音のメディアデータを扱う場合 • タイマリスナ ・・・ タイマを扱う場合 • メッセージフォルダリスナ・ メッセージフォルダを扱う場合 • オーディオ3Dリスナ・・・ 3D音源を扱う場合 どんなiアプリを作るのかが決まっていれば、、、その機能を選ぶだけですから簡単です。 そんなこんなで、ソースが出来ます。 /* * SH903_GPS.java * * DATE : 2007/01/XX 26:00 */ import com.nttdocomo.ui.IApplication; import com.nttdocomo.ui.Display; import com.nttdocomo.ui.Panel; import com.nttdocomo.ui.Frame; import com.nttdocomo.ui.Button; import com.nttdocomo.ui.Component; import com.nttdocomo.ui.ComponentListener; import com.nttdocomo.ui.KeyListener; import com.nttdocomo.util.Timer; import com.nttdocomo.util.TimerListener; /** * SH903_GPS * * @author NAME 観天望気 Presents! */ public class SH903_GPS extends IApplication { public void start() { /* * The program of IApplication is written here. */ Display.setCurrent((Frame)new MainPanel()); } } /** * MainPanel * */ class MainPanel extends Panel implements KeyListener, ComponentListener, TimerListener{ Button button = new Button("Button"); MainPanel() { setTitle("Start IApplication"); setKeyListener((KeyListener)this); add(button); setComponentListener((ComponentListener)this); Timer tm = new Timer(); tm.setTime(1000); tm.setRepeat(true); tm.setListener((TimerListener)this); // tm.start(); } public void keyPressed(Panel panel, int key) { } public void keyReleased(Panel panel, int key) { switch (key) { case Display.KEY_1: break; case Display.KEY_2: break; case Display.KEY_3: break; default: break; } } public void componentAction(Component source, int type, int param) { if (source == button) { if (type == BUTTON_PRESSED) { } } } public void timerExpired(Timer source) { } } GPSにより位置の測定、、、更には地図上に表示させる。 そのためにはどんな機能を使うのか? そんなクイズを解くような世界です。 ■ まとめ |
尾瀬で幕営しま専科 |
Copyright © 2002-2007 観天望気 All Rights Reserved. |