Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Reuse Java ME Codes in ADT

From Wiki
Jump to: navigation, search

Oracle Java ME SDK(former SUN's Java 2 Micro Editon SDK) and Nokia Asha SDK (former S40 SDK) can be both used to develope Java ME(Java Micro Edition) application,and have similar build libraries(many JAR files in subdirectory lib of SDK installation directory) for compiling Java ME codes.It is well known that there are lots of example codes in this platform,which may be reused in Android application coding after we selected those external JAR files as build libraries in ADT.This will be beneficial to developer in porting Java ME application to Android devices.This way is not fit for porting on UI but for kernel because Android platform has it own UI framwork.

Below is the way to use TimeZone API of Java ME in ADT.

1.Make a new Android project;

2.Open the properties of the projet; ProjectProperties.jpg

3.Select item Java Build Path and click tag Libraries and push down button Add External JARs; Libraries.jpg

4.Select midp10.jar in subdirectory lib of Nokia Asha SDK installation directory(C:\Nokia\Devices\Nokia_Asha_SDK_1_0\lib); JARSelection.jpg


5.Alter the of the project;

package com.example;
import android.os.Bundle;
import android.view.Menu;
import android.widget.Toast;
import java.util.*;
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
TimeZone tz = null;
tz = TimeZone.getDefault();
toastMessage( tz.getDisplayName() );
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(, menu);
return true;
protected void toastMessage(final String message) {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(MainActivity.this, message,Toast.LENGTH_LONG).show();

6.Run in emulator. TimeZoneAppInAVD.jpg

This page was last modified on 6 May 2014, at 05:52.
96 page views in the last 30 days.