×
Namespaces

Variants
Actions
(Difference between revisions)

Porting Android (Java) applications to Java ME on S60 5th Edition

From Nokia Developer Wiki
Jump to: navigation, search
juarezjunior (Talk | contribs)
(R.java)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Fix ArticleMetaData and RevieweApproval)
(18 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Category:Java ME]][[Category:S60]][[Category:Porting to S60]][[Category:Android]]
+
{{ArticleMetaData <!-- v1.1 -->
 +
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|id= <!-- Article Id (Knowledge base articles only) -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20090406
 +
|author= [[User:Jaaura]]
 +
}}
 +
 
 +
[[Category:Java ME]][[Category:S60]][[Category:Porting]][[Category:Android]]
 
===Introduction===
 
===Introduction===
  
Line 6: Line 30:
 
The Android platform includes an application framework, an operating system, a Java Virtual Machine called Dalvik, a web browser based on WebKit, SQLite database, middleware services and key applications.  
 
The Android platform includes an application framework, an operating system, a Java Virtual Machine called Dalvik, a web browser based on WebKit, SQLite database, middleware services and key applications.  
  
The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language. However, the Java APIs supported by Android are not standar Java ME APIs (JSRs), so in order to develop an Android application the developer must learn and cope with many new APIs.
+
The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language. However, the Java APIs supported by Android are not standard Java ME APIs (JSRs), so in order to develop an Android application the developer must learn and cope with many new APIs.
  
 
Android is built on the Linux Kernel and utilizes a custom virtual machine, commonly referred as Dalvik VM. Although the Android's kernel is based on Linux, developers can only use Java programming syntax to develop Android applications.
 
Android is built on the Linux Kernel and utilizes a custom virtual machine, commonly referred as Dalvik VM. Although the Android's kernel is based on Linux, developers can only use Java programming syntax to develop Android applications.
  
Java Micro Edition applications are not compatible with Android due to the new format of bytecodes used by Dalvik virtual machine and due to this fact developers must rewrite Android applications to work on S60 5th Edition devices or any other devices supporting standard Java ME.
+
Java Micro Edition applications are not compatible with Android due to the new format of byte codes used by Dalvik virtual machine and due to this fact developers must rewrite Android applications to work on S60 5th Edition devices or any other devices supporting standard Java ME.
  
This articlpe provides an overview of Android in an extent that will allow you to port Android applications to S60 5th Edition, focusing on Java ME.
+
This article provides an overview of Android in an extent that will allow you to port Android applications to S60 5th Edition, focusing on Java ME.
  
  
[[Image:phoneimage.jpg]]
+
[[File:phoneimage.jpg]]
  
  
[[Image:nokia.jpg]]
+
[[File:nokia.jpg]]
  
 
=== Android platform - Architecture ===
 
=== Android platform - Architecture ===
Line 26: Line 50:
 
As mentioned before, Android has virtual machine called Dalvik and every Android application will run on its own process, that is, using its own instance of Dalvik JVM.
 
As mentioned before, Android has virtual machine called Dalvik and every Android application will run on its own process, that is, using its own instance of Dalvik JVM.
  
The Dalvik JVM runs files called Dalvik executables (.dex files), a kind of Java bytecode optimized for the Android platform. The Linux Kernel is based on version 2.6.
+
The Dalvik JVM runs files called Dalvik executables (.dex files), a kind of Java byte code optimized for the Android platform. The Linux Kernel is based on version 2.6.
  
At last, Android code can use the 1.5 version of Java language (Tiger), so the Tiger features are available for Android.  
+
At last, Android code can use the 1.5 version of Java language (Tiger), so the Java Tiger features are available for Android. It means you can use Generics, enhanced for loop, auto boxing e other new features of language when developing Android software.
  
[[Image:Android-architecture-485b.jpg]]
+
Java RT for S60 has two newer versions, called JRT 1.3 (S60 5th Edition) and JRT 1.4 (S60 3rd Edition FP2). So, on the contrary, when porting Android code to S60 Java, in case you come across Java Tiger code, you will need to convert them back to Java 2 language, as both JRT 1.3 and 1.4 do not support Java Tiger.
 +
 
 +
For more information about JRT, please check this article [[Naming and versioning of Java Runtime for Symbian]]
 +
 
 +
 
 +
[[File:Android-architecture-485b.jpg]]
  
 
=== Application Development ===
 
=== Application Development ===
Line 41: Line 70:
 
*An Activity has the main callback methods and is linked (represents) a blank screen in a logical way (an application may have several Activity classes);
 
*An Activity has the main callback methods and is linked (represents) a blank screen in a logical way (an application may have several Activity classes);
 
*An Intent represents an action and it is composed by <action> and <category> XML elements. Then the IntentReceiver and IntentFilter (<intent-filter> element) will take care of its action processing and guarantee that the right Intent will be processed;
 
*An Intent represents an action and it is composed by <action> and <category> XML elements. Then the IntentReceiver and IntentFilter (<intent-filter> element) will take care of its action processing and guarantee that the right Intent will be processed;
*AndroidManifest.xml - the components above are controlled by means of the AndroidManifest.xml configuration file, that is a kind of descriptor for the Android application.
+
*AndroidManifest.xml - the components above are controlled by means of the AndroidManifest.xml configuration file, which is a kind of descriptor for the Android application.
  
 
==== User Interfaces ====
 
==== User Interfaces ====
Line 57: Line 86:
 
Some examples of layouts are AbsoluteLayout, FrameLayout, LinearLayout and RelativeLayout.
 
Some examples of layouts are AbsoluteLayout, FrameLayout, LinearLayout and RelativeLayout.
  
[[Image:Android-gui.jpg]]
+
[[File:Android-gui.jpg]]
  
 
====Project Structure====
 
====Project Structure====
Line 71: Line 100:
  
  
[[Image:Android-project-fn-2.jpg]]
+
[[File:Android-project-fn-2.jpg]]
  
  
Line 91: Line 120:
  
  
Below we have the code for a simple Activity. Note that it overrides and implements the public void onCreate(Bundle savedInstanceState) method. This method must be overriden to allow an activity to be created.  
+
Below we have the code for a simple Activity. Note that it overrides and implements the public void onCreate(Bundle savedInstanceState) method. This method must be overridden to allow an activity to be created.  
  
 
In some way it can be compared to MIDlet's startApp() method, so while there is no direct matching of methods between Android and standard Java ME given that approaches and strategies are very different, when porting your application you will convert the main Activity (main screen) to your MIDlet's startApp() and then convert the other activities to classes that will implement the functionality on your Java ME application.  
 
In some way it can be compared to MIDlet's startApp() method, so while there is no direct matching of methods between Android and standard Java ME given that approaches and strategies are very different, when porting your application you will convert the main Activity (main screen) to your MIDlet's startApp() and then convert the other activities to classes that will implement the functionality on your Java ME application.  
Line 159: Line 188:
 
==== strings.xml ====
 
==== strings.xml ====
  
This file may be converted to standalone resource file (simple .txt file, for example, kind of resource bundle), JSR-238 file (MIA) or into entries on JAD file to hold your literal, constant values, avoiding some hardocoded values on your source code.
+
This file may be converted to standalone resource file (simple .txt file, for example, kind of resource bundle), JSR-238 file (MIA) or into entries on JAD file to hold your literal, constant values, avoiding some hardcoded values on your source code.
 +
 
 +
So there is no need to port this file, just create a similar one in S60 Java ME application to achieve the same purposes.
  
 
<code language="xml">
 
<code language="xml">
Line 171: Line 202:
 
</code>
 
</code>
  
====Packages====
+
==== main.xml ====
 +
 
 +
This file expresses the layout being used by the Android application, regarding its GUI.
 +
 
 +
In Java ME, you can control it using the new layout features that are available in frameworks like LWUIT, eSWT or even the limited support that is available in MIDP. So there is no need to port this file or create a similar one in S60 Java ME application.
 +
 
 +
To achieve the same layout organization, it is advisable to read and understand the layout classes that are available in Android, cited above in one of the previous sections of this article.
 +
 
 +
<code language="xml">
 +
 
 +
<?xml version="1.0" encoding="utf-8"?>
 +
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 +
    android:orientation="vertical"
 +
    android:layout_width="fill_parent"
 +
    android:layout_height="fill_parent"
 +
    >
 +
<TextView 
 +
    android:layout_width="fill_parent"
 +
    android:layout_height="wrap_content"
 +
    android:text="@string/hello"
 +
    />
 +
</LinearLayout>
 +
 
 +
</code>
 +
 
 +
==== Java APIs (packages) - Android and Java ME ====
 +
 
 +
To get the detailed description about each class you can refer the Javadoc documentation that is available in both platforms.
  
To get details description about each classes you can refer docs available for both platform. Generally APIS which is used for business logic are similar. It uses the concept of activity and intent which we can port into our platform's event architecture and APIs provided by it.
+
*[http://library.developer.nokia.com/topic/Java_Developers_Library/GUID-660EC670-B7DB-4005-BF2D-411E5C0B3867_overview-d0e56352.html S60 5th Edition - Java ME]
  
===API Similarities and Difference===
+
*[http://developer.android.com/reference/packages.html Android]
The android have following java packages.
+
[[Image:supported.jpg]]
+
  
The following java packages is not available in android which is so similar to J2ME as most of it is not included in j2me too by considering the small devices limitation.
+
====Deployment Packages====
  
[[Image:Not Supprted.jpg]]
+
Nokia - JAD, JAR files
  
====Installable====
+
Android - APK files
  
Nokia - Jad, Jar
+
====Application Signing====
  
Android - .apk(using Ant)
+
Nokia supports: VeriSign, Thawte, Java Verifed (UTI) certificates
  
====Signing====
+
Android supports: VeriSign, Thawte, self-issued certificates (using tools like keytool)
Nokia supports: VeriSign, thawte, Java Verifed Certificate etc
+
  
Android supports: by private key ( Tools like Keytool and Jarsigner)
+
====Tools - SDKs and IDEs ====
  
 +
*[http://www.oracle.com/technetwork/java/javame/downloads/index.html Wireless tool kit(WTK)]
 +
*[http://www.developer.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html Nokia S60 SDK]
 +
*[http://netbeans.org/ NetBeans]
 +
*[http://www.eclipse.org/ Eclipse]
  
====Tools====
+
===Restricted APIs (permissions)===
*[http://java.sun.com/javame/downloads/index.jsp Wireless tool kit(WTK)]
+
*[http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html Nokia S60 SDK]
+
  
===Permission of Resource===
+
On Android the developer needs to set permissions in the AndroidManifest.xml file to allow the access to some restricted APIs or resources. Android applications must also be signed with a certificate whose private key is held by their developer, but it can use a self-issued certificate.
  
In android the developer need to set permission in the manifest file of android project to let the application or user to access the resource while in j2me if application is not sign then application will ask the permission to user while executing it and by signing it will be secure so there is no need of permission confirmation for most of the resource.
+
Regarding Java ME, if application is not signed then the application will ask the permission to user while executing it and by signing it will be granted automatically, so there is no need to get explicit permission confirmation for most of the resources and restricted API calls.
  
===Data Storage on device===
+
===Data Storage===
J2ME : RMS
+
J2ME : RMS, FileConnection
  
android : SQLite database.
+
Android : Preferences, Files, Databases, Network storage and SQLite database

Revision as of 08:04, 9 February 2012

Article Metadata
CompatibilityArticle
Created: jaaura (06 Apr 2009)
Last edited: hamishwillee (09 Feb 2012)

Contents

Introduction

Android is a platform for mobile devices maintained by Google and supported by the Open Handset Alliance.

The Android platform includes an application framework, an operating system, a Java Virtual Machine called Dalvik, a web browser based on WebKit, SQLite database, middleware services and key applications.

The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language. However, the Java APIs supported by Android are not standard Java ME APIs (JSRs), so in order to develop an Android application the developer must learn and cope with many new APIs.

Android is built on the Linux Kernel and utilizes a custom virtual machine, commonly referred as Dalvik VM. Although the Android's kernel is based on Linux, developers can only use Java programming syntax to develop Android applications.

Java Micro Edition applications are not compatible with Android due to the new format of byte codes used by Dalvik virtual machine and due to this fact developers must rewrite Android applications to work on S60 5th Edition devices or any other devices supporting standard Java ME.

This article provides an overview of Android in an extent that will allow you to port Android applications to S60 5th Edition, focusing on Java ME.


Phoneimage.jpg


Nokia.jpg

Android platform - Architecture

Android architecture is basically divided into several components: Application Framework, Libraries, Android Runtime and Linux Kernel.

As mentioned before, Android has virtual machine called Dalvik and every Android application will run on its own process, that is, using its own instance of Dalvik JVM.

The Dalvik JVM runs files called Dalvik executables (.dex files), a kind of Java byte code optimized for the Android platform. The Linux Kernel is based on version 2.6.

At last, Android code can use the 1.5 version of Java language (Tiger), so the Java Tiger features are available for Android. It means you can use Generics, enhanced for loop, auto boxing e other new features of language when developing Android software.

Java RT for S60 has two newer versions, called JRT 1.3 (S60 5th Edition) and JRT 1.4 (S60 3rd Edition FP2). So, on the contrary, when porting Android code to S60 Java, in case you come across Java Tiger code, you will need to convert them back to Java 2 language, as both JRT 1.3 and 1.4 do not support Java Tiger.

For more information about JRT, please check this article Naming and versioning of Java Runtime for Symbian


Android-architecture-485b.jpg

Application Development

Application Components

The main components of an Android application are: Activity, IntentReceiver, Service and ContentProvider. Depending on the kind of application one might be developing, not all components will be present in an application. In short, they are defined as below:

  • An Activity has the main callback methods and is linked (represents) a blank screen in a logical way (an application may have several Activity classes);
  • An Intent represents an action and it is composed by <action> and <category> XML elements. Then the IntentReceiver and IntentFilter (<intent-filter> element) will take care of its action processing and guarantee that the right Intent will be processed;
  • AndroidManifest.xml - the components above are controlled by means of the AndroidManifest.xml configuration file, which is a kind of descriptor for the Android application.

User Interfaces

The main components are the android.view.View and android.view.ViewGroup.

  • The View represents a graphical area on the device's screen and by means of it you can find out the width and height, set focus, control scrolling and key handling for the correspondent area. It is very extensible and several Android Widgets extend from View.


Some examples of Widgets are AbsListView, AbsSeekBar, AbsSpinner, AppWidgetHostView, AutoCompleteTextView, Button, CheckBox, CheckedTextView, Chronometer, CompoundButton, DatePicker, DialerFilter, DigitalClock, EditText, ExpandableListView, ExtractEditText, FrameLayout, GLSurfaceView, Gallery, GridView, HorizontalScrollView, ImageButton, ImageSwitcher, LinearLayout, ListView, MediaController, MultiAutoCompleteTextView, RadioButton, RadioGroup, RatingBar, RelativeLayout, ScrollView, SeekBar, SlidingDrawer, Spinner, TabHost, TabWidget, TableLayout, TableRow, TextSwitcher, TimePicker, ToggleButton, TwoLineListItem, VideoView, ViewAnimator, ViewFlipper, ViewSwitcher, WebView, ZoomButton and ZoomControls.

  • The ViewGroup is a container of View, that is, it is a container class and helps defining the layout characteristics of your GUI.

Some examples of layouts are AbsoluteLayout, FrameLayout, LinearLayout and RelativeLayout.

Android-gui.jpg

Project Structure

XML files play a major role in android application development, mainly regarding configuration and declaration of resources. But standard Java ME does not use the same approach, so the mapping that is done using the AndroidManifest.xml (events mapping to actions) do not exist in Java ME by default. You will need to analyze the Android manifest and implement the logical mapping on your S60 Java ME application using well known patterns like MVC, Command, Dispatcher and others.

Just as an example, when developing an Android application, in order to create the GUI, navigation mapping and action linkage generally the developer uses some XML files and refer each component using its ID. In standard Java ME as available in S60 devices, there is no such mapping imposed by the platform so one should refer each component by name and instance reference, using its source file (class definition) itself.

Below we have a very basic project structure regarding an Android project:


Android-project-fn-2.jpg


In summary:

  • The src folder is where your all the classes created explicitly by the developer will be located. You can see a basic Activity class in this folder, inside the com.forum.nokia.android.to.s60 package;
  • The gen folder has several classes that are created automatically by Android and should never be edited manually by the developer;
  • The android.jar that is included on the classpath and has the Android framework;
  • The res folder that contains all the resources used by the application, such as images (drawable subfolder has icon.png file), layouts (layout subfolder has the main.xml file, defining the layout for GUIs), static values, kind of resource bundle (values subfolder has the string.xml file where declarative values will be declared);
  • AndroidManifest.xml - as cited before, it is the main configuration file for the Android application.

Porting Guidelines

AndroidStandardActivity.java

Below we have the code for a simple Activity. Note that it overrides and implements the public void onCreate(Bundle savedInstanceState) method. This method must be overridden to allow an activity to be created.

In some way it can be compared to MIDlet's startApp() method, so while there is no direct matching of methods between Android and standard Java ME given that approaches and strategies are very different, when porting your application you will convert the main Activity (main screen) to your MIDlet's startApp() and then convert the other activities to classes that will implement the functionality on your Java ME application.

Depending on the coding style, architecture or convention you or your company use, you can convert them to:

  • Java class that implements the Runnable interface (separate thread);
  • Java class that extends Form or Canvas;
  • Java class that extends Object but has several business methods (Business Object design pattern).


So, the takeaway here is that while Android works with several separate Activity classes, each having its own callback methods and others, your Java ME will have only one (or maybe more if preferred) MIDlet classes and the remaining Activity classes will be converted to one of the examples cited above (Thread, Canvas, Form or BO).


Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, asm, asp, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, oobas, oracle11, oracle8, oxygene, oz, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, python, q, qbasic, rails, rebol, reg, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, uscript, vala, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


package com.forum.nokia.android.to.s60;

import android.app.Activity;
import android.os.Bundle;

public class AndroidStandardActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

R.java

The is no need to replicate the class below to standard Java ME application as it is proprietary to Android and Java ME does not consider the same approach. So you can ignore it, but it can help you figure out the correspondence that exists among layouts, strings and other resources in an Android application.

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, asm, asp, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, oobas, oracle11, oracle8, oxygene, oz, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, python, q, qbasic, rails, rebol, reg, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, uscript, vala, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.forum.nokia.android.to.s60;

public final class R {
    public static final class attr {
    }
    public static final class drawable {
        public static final int icon=0x7f020000;
    }
    public static final class layout {
        public static final int main=0x7f030000;
    }
    public static final class string {
        public static final int app_name=0x7f040001;
        public static final int hello=0x7f040000;
    }
}


strings.xml

This file may be converted to standalone resource file (simple .txt file, for example, kind of resource bundle), JSR-238 file (MIA) or into entries on JAD file to hold your literal, constant values, avoiding some hardcoded values on your source code.

So there is no need to port this file, just create a similar one in S60 Java ME application to achieve the same purposes.

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, asm, asp, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, oobas, oracle11, oracle8, oxygene, oz, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, python, q, qbasic, rails, rebol, reg, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, uscript, vala, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello World, AndroidStandardActivity!</string>
    <string name="app_name">AndroidToS60Porting</string>
</resources>

main.xml

This file expresses the layout being used by the Android application, regarding its GUI.

In Java ME, you can control it using the new layout features that are available in frameworks like LWUIT, eSWT or even the limited support that is available in MIDP. So there is no need to port this file or create a similar one in S60 Java ME application.

To achieve the same layout organization, it is advisable to read and understand the layout classes that are available in Android, cited above in one of the previous sections of this article.

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, asm, asp, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, oobas, oracle11, oracle8, oxygene, oz, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, python, q, qbasic, rails, rebol, reg, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, uscript, vala, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
</LinearLayout>

Java APIs (packages) - Android and Java ME

To get the detailed description about each class you can refer the Javadoc documentation that is available in both platforms.

Deployment Packages

Nokia - JAD, JAR files

Android - APK files

Application Signing

Nokia supports: VeriSign, Thawte, Java Verifed (UTI) certificates

Android supports: VeriSign, Thawte, self-issued certificates (using tools like keytool)

Tools - SDKs and IDEs

Restricted APIs (permissions)

On Android the developer needs to set permissions in the AndroidManifest.xml file to allow the access to some restricted APIs or resources. Android applications must also be signed with a certificate whose private key is held by their developer, but it can use a self-issued certificate.

Regarding Java ME, if application is not signed then the application will ask the permission to user while executing it and by signing it will be granted automatically, so there is no need to get explicit permission confirmation for most of the resources and restricted API calls.

Data Storage

J2ME : RMS, FileConnection

Android : Preferences, Files, Databases, Network storage and SQLite database

475 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×