Both Android and Blackberry apps are made in Java. Does it mean that I can code some logic interdependent to Android SDK and use it when porting the app to Blackberry?
Does anyone has experience in this field?
Sure you can do it. The logic would not be different but the implementation of the logic depend upon the Platform you are choosing. In Blackberry it uses java-me but there are some limitation you can not use in Blackberry like there is no ArrayList or HashMap in Blackberry but its available in Android so you have to use some alternative of ArrayList or HashMap while porting for the Blackberry you can use Vector instead of that. There is also some limitation of using java.lang.utils package in Blackberry. May be this would be helpful for you.
I'm working on an application that runs on both Android and Blackberry.
I work only on the Android client but I know that only few things can be shared. Of course only the classes that do not have to do with the framework. Another problem is that, Blackberry uses only J2ME that means that for example you can't even use semaphore or other things like that.
In my application all the protocol level is shared though.
Sure you can. Create a plain Java project and make sure you only use classes available in Android and Blackberry. Add the project dependency to your Android and Blackberry project. Alternatively, you can export a jar file and link your projects to it.
Related
Not all Java Packages are part of Android but is there a way to gain access to them through some work around? Purely as an example javax.sound is one such class. Yes Android has classes to do the same thing but if we already had the working Java written, rewriting it all using Android APIs is not ideal.
Is there any way to use the Java API or do we have to use the Android API?
No, not all Java libraries have been ported to Android. You will need to use the Android-specific implementation, especially for things that deal with the hardware layer or require a specific technology stack, such as audio libraries.
Yep totally you can but it depending on which libs that you want to use for example you cant use databases drivers in your android apps, neither UI libs , but you can use gson for example
I need to create an API library for Android and iOS. I have experience working with Android projects, but zero experties in iOS. I was wondering if I could create a Project library in Xamarin that compiles as a JAR for Android and as an... I-don't-know-which-type for iOS.
No, that isn't possible. Depending on what you are trying to accomplish there may be alternatives. If you are trying to make a library that can be used by others you could make it a Xamarin component - there is a component store you could put it on if you want it to be generally available, otherwise you can use any normal means of source or object distribution.
If you need to interact with a native app/library then you could make the C# code the "owner" of it and have it call into the native code. This works for both IOs and Android (and is used to work with e.g the play services from google).
No, it is unfortunately not possible to do that.
It seems to me that what you need is a Portable Class Library also known as PCL. It allows you to create a project which can be referenced by all Xamarin supported platforms (such as iOs and Android). There are obviously limitations to the approach like not being able to reference platform specific libraries but in your case (of writing an API) it should suffice.
You can read more in this link
Good Luck!
I want to know more about Cross-Platform. I'm currently working on my thesis and decided to make an Android Application but not all target users uses Android device. So, We've come up with an idea to Cross-Platform the android application.
I have read the same topic but it didn't get to me too well. iOS / Android cross platform development. I want to know if there is another way than using the frameworks discussed in the link.
I want know what is the best/shortest way to cross platform a Android Application?
Cross Platform tools are in my opinion not a good idea at all. Android is Java, and iOS is Objective C. Android can use NDK to use a C/C++ library so theoretically if you did most of your code in C/C+ it could be used on both sides. I think two natives is more in order. Study NDK to see what could run on both devices. Lets say you built your app as a C++ Library except for UI interactions. Then in theory the library should work on both sides. C/C++ a lot easier on iOS than android however.
Also it really depends on the dependencies your app will have. Lets say you want to use a library but its only available in Java or C++ how does this effect your decision.
You might also consider designing your app so that it just captures data on the devices and the actual processing of the data takes place in a web service.
Another way is use Mobile Web HTML5 Framework like Phonegapp, Sencha touch and more.
Although web technologies don’t perform as well as native, but it is a useful thing that you can try.
See Choosing Mobile Web HTML5 Framework and http://operationproject.com/2011/adventures-in-html5-part-one/
Android application are apk files that are basically zip file that contains dex/odex files and all other resources that you may wish to add.But I think you can use any coding language to develop as long as you have IDE that converts your code to apk and dex .And most important of all your programming language must support corresponding api or must have something similar to cross compile.The reason Google used Java for Android was they felt it is convenient to do it(read it during case Google v/s Oracle)
Personally I feel cross-platform is good since it increases the developers base and understanding of the System (here Android).And I think the same analogy would go with other Systems as well.
I have my own C++ library with source code. It contains functions like this: CreateDvice, FillDevice, CloseDevice and etc. There is no dependency to any third-party libraries.
There is requirement to create application for mobile platform:
Blackberry
iPhone
Android
The application has to use logic provided by this library.
Is there chance to use existing library in mobile application or at least some of them?
Or does it require to re-implement library code for each platform?
For iOS (iPhone/iPad) you can directly compile your library and use it from a regular iOS app written in Objective-C++ and/or C++.
For Android you can directly compile your library using the NDK, then either write your app in Java and call your library via JNI, or write the whole app in C++ using the NDK.
I believe you are out of luck on Blackberry, for this platform you'll need to rewrite your library in Java, as neither apps or libs can be written in C++.
Edit: See my other answer for a completely different approach that may work for you.
Blackberry:
It's technically possible to have ASM on BlackBerry (or Android, iPhone, etc.) but 3rd-party developers are often not allowed (or not able in the case of BlackBerry) to do so.
iPhone:
Absolutely. You can statically link a C++ library. Of course it will have to be compiled with the right instruction set. There are a host of examples out there on how to do this. Translate - you will need the code.
Android:
Absolutely. There is a good book on this by Mark Murphy. Introductory material here:
http://www.androidguys.com/2009/10/14/android-beyond-java-part-one/
Your question is unclear. Do you need a cross-platform library/engine to create a mobile application?
If it is so, Cocos2D would be the best choice. Originally it's a game engine, but it is suitable for applications too. And it supports all the platforms written above.
Instead of compiling your C++ library on each target device that you intend to support, you could opt for creating a service that packs your library. You can install this library on a host you have control, then from each platform the only thing you need to do is invoke this service.
I'm not sure if this thing makes sense for the kind of library that you have, but this would be a way to maintain a single version of your library, and you'll have a guaranteed same behavior on all devices.
Good luck.
Android is not natively Java, it's natively C++. And iOS is also natively C++. So why not just leave the C++ code untouched and drop RIM's current platform (since they are switching to BBX which does support C++ as well).
For Blackberry you can use the C++/Qt Cascades; for iOS you can use C/C++ & Objective-C (a superset of C) and Android can use the C++ NDK. You can use Java on all platforms as long as the Java apps are standalone and the JRE is pre-packaged with the app (iOS). You can interface with C/C++ libs using JNI
If you want to use a Java library on all platforms, that would work.
Android and Blackberry are natively Java.
You can use a tool called XMLVM to cross-compile your Java library to Objective C for use on iOS.
http://xmlvm.org/overview/
It is not 100% perfect, but pretty darn close. We use it extensively to port common Java library code to iOS. Port the C++ library to Java and you are good to go.
Is there a handy-dandy equivalent to org.apache.commons.beanutils.PropertyUtils on Android?
I can't seem to use bean utils in my android app due to some dependencies on PropertyDescriptor,and IndexedPropertyDescriptor. So I'm wondering if there are any alternatives?
Basically all I want to do is use a method name as a string "someMethod" and feed that into setMethod(anObject, "someMethod", value), much like PropertyUtils does; but without having to resort to the nasties of reflection...
Or are my hands tied and I need to use Reflection?
There is bridge library which works on Android: android-java-air-bridge.jar. Just include into project path and use all apache beanutils features in your Android project as you could use in ordinary java application. Moreover, there are lot of other classes which moved to this Android supporting library. Look at the list.
There is a possibilty to use libraries or write own code depending on the PropertyUtils. But it sure isn't dandy. You can get the general idea about what has to be done in this thread.
There are apparently some projects who have successfully solved the issue, so you can study thier solution. Take a look at Drawingpad-base and libgdx. You can find PropertyUtils in the package com.madrobot.beans in the first project and com.badlogic.gdx.beans in the second.