views:

58

answers:

2

Is there a way to develop classes for Android and BlackBerry ? In this I mean that BlackBerry and Android have different collections.

So I would like to know what is the best way to develop such files (reflection, different files, ...)

+1  A: 

We have common code for Android and BlackBerry. You know that BlackBerry is J2ME based so its Java 1.3 compatible, and Android is Java 1.6 I think. This places significant limitations. I will list what I remember below.

  1. All common modules you code has to be Java 1.3 compatible if you want it to work on both platforms. This means no collections framework, no reflection, primitive string handling/localization with strings in class files etc.
  2. It will be very hard to have ALL code that is works on both platforms. So it is better to have some common packages, then BlackBerry and Android packages that work on those platforms.
  3. Nightly build system is really helpful as it will catch errors that break one platform build, caused by changes for the other platform.
omermuhammed
I was wondering if there was any pre-compiler things like in C/C++ or BlackBerry but prebuild in java
fedj
BlackBerry allows only 2 preprocessor commands (#preprocessor and #implicit), Android does not have preprocessor support. You can of course right your own, but if you do Android development correctly you wont need it.
omermuhammed
Blackberry supports newer versions of Java than 1.3. In my BB app (don't have an Android version yet), I have been coding to 1.3 lately, but at times I've done 1.4 and 1.5 (but then Eclipse started having problems so I went back a couple of versions). If you use Eclipse for your Java development, the BB development environment supports additional preprocessor keywords, such as #ifdef, #ifndef, and #else, with custom defines.
Remy Lebeau - TeamB
+2  A: 

Your best bet is to write to a common interface, so that your higher-level code can be consistent, and the parts that will be different, will be abstracted into their own libraries. This way you can write applications that use a common codebase, though most of the work will take place in your libraries, as that is where you connect to the platform.

This way you can try to minimize redundant work, but take advantage of each platform more completely.

If you limit yourself to what each can do then you are shortchanging your users as there are a great deal you will not be able to do, or do well.

James Black