开发者

Porting blackberry application code in to Android platform

I have an Blackberry library written using JAVA as well Blackberry(RIM) specific API's. I would like to port the same library in to Android platform without making any code changes开发者_如何学运维 and make it run.

Here i am looking for the best way to achieve it

Any cross compiler/cross framework is available for making my Blackberry run on Android platform.Thinking this would make my job easy ;)

Please share your inputs on this. Thanks in advance.


You can't do that. AFAIK, Blackberry uses J2ME technologies(can be wrong here). Android system is built in absolutely other principles. You have got to learn android in order to understand how to build GUI, how to process with background tasks and where you store your data. Sorry.

Start with application fundamentals.


If porting was that easy, a lot of developer would be out of work.

You will not have to rewrite the whole application, but surely there must be quite a few changes done. If you have a clean design, you might be able to reuse a lot of code as it is. Otherwise it will get more complicated. For the RIM API, it might be a good idea to write interface-classes first ("RIMXyz implements IntrfXyz"), that have all the function-call that you use of the RIM-API. Then you can write the Android API classes using "AndrXyz implements IntrfXyz". Put the RIM-dependend stuff in a separate external lib, and do the same with the android-dependent stuff. Then you can have a RIM-prj and an Android-prj, each only linking to the dependent classes and the reusable classes. That way you could structure you porting project quite nicely. Also the "top" end of the application surely has to change, because you have to use the "activity"-class in Android to get anything running. Those are the two aspects I see.

I hope this is understandable, a bit hard to put it in a few words... I have started a cross-platform project for Android/Java applet, and this is how I've done it. It works. ;-)


You cannot do this without some code rewrite. If you can tell us more about the classes in the RIM API that you are using, you might get some specific answers as to what classes from the Android API to use.


You should find similar functions in android api to replace RIM API invocations and refactor your code using for example Abstract Factory design pattern. (http://sourcemaking.com/design_patterns/abstract_factory)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜