思路无非3种:

1, 提供一个android下的j2me虚拟机,让j2me程序运行 如OPhone下的百宝箱

2, 提供一个转换工具,将j2me的jar放入apk中,重新用apt制作成apk安装程序,并允许,如netmite

3, 提供类库中间层,将android中没有的j2me类库用android的程序实现出来,并用android sdk重新编译成apk 如J2AB

考虑到已有j2me工程QMusic的整套代码,同时代码本身如歌曲扫描,播放,界面刷新,有优化的余地,屏幕尺寸需要适应等问题,故采用第3种做法,从j2ab倒入代码,并添加未实现类库,程序可以运行,再通过细调,最终得以完全展现在android平台上。并较好的解决了屏幕变化带来的影响,为之后类似的工作打下基础,扩充的类库列表如下,备忘:

public class J2ABMIDletActivity extends Activity implements Toolkit

package j2ab.android.io.file;

public class AndroidURLConnection implements HttpConnection

public class LogOutputStream extends OutputStream

public class AndroidFileConnection implements FileConnection

package j2ab.android.lcdui;

public interface Toolkit

package j2ab.android.pim;

public class AndroidContactList extends AndroidPIMList implements ContactList

public class AndroidPIMItem implements PIMItem

public abstract class AndroidPIMList implements PIMList

public class PreloadingAndroidPIMItem extends AndroidPIMItem

package javax.microedition.io;

public interface Connection

public class ConnectionNotFoundException extends IOException

public class Connector

public interface HttpConnection extends StreamConnection

public interface InputConnection extends Connection

public interface OutputConnection extends Connection

public interface StreamConnection extends InputConnection, OutputConnection

package javax.microedition.io.file;

public interface FileConnection extends javax.microedition.io.Connection, StreamConnection
public interface FileSystemListener

public class FileSystemRegistry

package javax.microedition.lcdui;

public class Alert extends Screen

public class AlertType

public abstract class Canvas extends Displayable implements OnKeyListener

public interface Choice

public class ChoiceGroup extends Item implements OnKeyListener, Choice

public class Command

public interface CommandListener

public class Display

public abstract class Displayable

public class Font

public class Form extends Screen

public abstract class GameCanvas extends Canvas

public class Gauge extends Item implements Runnable

public class Graphics

public class IconItem extends StringItem

public class Image

public abstract class Item

public interface ItemCommandListener

public abstract class Layer

public class List extends Screen implements OnKeyListener

public abstract class Screen extends Displayable

public class Sprite extends Layer

public class StringItem extends Item implements Runnable

public class Style

public class TextBox extends Screen implements Runnable

public class TextField extends Item implements Runnable

public class TiledLayer extends Layer

package javax.microedition.media;

public class AndroidMediaPlayer implements Player, Controllable

public interface Control

public interface Controllable

public class Manager

public class MediaException extends Exception

public interface Player extends Controllable

public interface PlayerListener

public class TonePlayer implements Player, ToneControl, Controllable

package javax.microedition.media.control;

public interface ToneControl extends Control

public interface VolumeControl extends Control

package javax.microedition.midlet;

public abstract class MIDlet

public class MIDletStateChangeException extends Exception

package javax.microedition.pim;

public interface Contact extends PIMItem

public interface ContactList extends PIMList

public class PIM

public class PIMException extends Exception

public interface PIMItem

public interface PIMList

package javax.microedition.rms;

public class InvalidRecordIDException extends RecordStoreException

public interface RecordComparator

public interface RecordEnumeration

public interface RecordFilter

public class RecordStore

public class RecordStoreException extends Exception

public class RecordStoreNotFoundException extends RecordStoreException

public class RecordStoreNotOpenException extends RecordStoreException

近似替代对象:

Canvas <===> SurfaceView
TextBox,List,Form,ChoiceGroup,StringItem <===> XML+view.inflate
Graphics <===> Canvas
Image <===> Bitmap
Player <===> MediaPlayer
MIDlet <===> Activity
ContactList,media file scan <===> ContentResolver
RecordStore <===> Hash File,SQLite
HttpConnection <===> HttpURLConnection
FileConnection <===> File
/res/... <===> AssetManager.open("res/...")

更多相关文章

  1. android 代码优化:关闭输出日志
  2. android box2d小程序
  3. [置顶] Android模拟打电话应用程序实现分析
  4. 【23】Android 应用程序入口探究
  5. Android程序开发初级教程(一)
  6. 如何降低android应用程序的耗电量

随机推荐

  1. android画统计图的chart engine
  2. android页面间传递对象
  3. Android电池管理
  4. Android定制出厂默认输入法
  5. Android学习
  6. Android(安卓)图片缩放与旋转
  7. android 如何在对话框中获取edittext中的
  8. This Android(安卓)SDK requires Android
  9. mapView 和textView布局
  10. 大话企业级android读书笔记(三)