29

来自J2ME编程是否有任何相似之处可以使其易于适应Android API。或者与编写移动应用程序Android API的方式完全不同。J2ME

4

4 回答 4

20

实际上,Android API 比 J2ME 强大得多。

为 Android 创建应用程序要容易得多。

使用 J2ME,由于缺少类似 swing 的库,您只能使用简单的表单(尽管现在存在一个名为 LWUIT 的库,避免了从头开始重新创建类似 swing 的库的需要)。

在 Android 中,您将能够非常快速地创建复杂的表单,并且 android SDK 的软件包易于安装(而在 J2ME 中,您必须安装 sun 的无线开发工具包,或者安装 Nokia、Samsung 或 SonyEricsson 中的一种。 . 它有时会有点混乱)。

从 j2me 切换到 android 时我必须改变的事情是:

1/ 字体和图形类在 j2me 上更容易使用。该 API 在 Android 上更彻底,但也更复杂。

2/如果你习惯了j2me(RecordStore)的数据库存储,那么在Android中你可以忘记它。您将不得不使用类似 SQL 的数据库,因此请准备好重新考虑您的数据模型。

于 2008-09-17T03:26:06.570 回答
12

I've also found the path from Java ME to Android to be pretty simple. Here are a few things I've noticed:

  1. There is ONE ui draw thread in Android. You have to be aware of the difference between calling postInvalidate and invalidate on Views to force them to update.

  2. The actual bit-wise graphic manipulation is very similar. I was able to port large amounts of custom J2ME draw code by writing a few shims for drawRect and drawImage.

  3. Android's UI library is much more extensive, much less useless, and much more complicated than Java ME's

  4. Threadwise, you have to be much more careful about thread saftey with Android. In Java ME you can get away with not making methods synchronous or variables volatile most of the time. Not so in Android.

I will say, on the whole, that Android's UI library fails a critical test. I call this the "roll my own" test.

Your UI library fails this test if it takes me longer to complete a detailed task task (say, changing the background on one individual menu item) than it would take me two write my own Menu from scratch. Android fails the "roll your own" test by a factor of 3 or 4. In fact, if you look, the majority of the questions on this website are "How do I make the Android UI toolkit do my bidding?" questions.

Android is an amazing platform and it has been worth every frustrating moment I've sunk into it. It is, however, a young platform, and needs some serious work in times to come.

于 2009-02-11T23:00:26.937 回答
7

一个好的开始是观看 Android 架构视频并查看一些文档。

http://www.youtube.com/view_play_list?p=586D322B5E2764CF http://code.google.com/android/what-is-android.html

谷歌非常擅长记录。据我所知,Android 的目标与 J2ME 非常相似。它在编程风格和结构上可能略有不同,但如果您有 J2ME 经验,那么您应该更准备好转向 Android。

祝你好运!!!

于 2008-09-15T20:11:58.230 回答
0

好吧,你可能实际上不需要适应。

由于 Android 不应该像 iPhone 那样限制第三方运行时,J2ME 堆栈很可能很快就会在 Android 上可用。

我认识一个一直在做这件事的人:http: //justanapplication.wordpress.com/

当然,这并不意味着您不应该查看 Android API 和应用程序生命周期。

于 2008-09-18T15:57:31.590 回答