Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Doing some investigation on the feasibility of using QT/QML for an upcoming project. Client wants it initially on Windows and Mac desktops, with the possibility of iOS and Android down the road. They would like to know that what we build will move relatively easily. I'm not much of a desktop programmer, but what I see is that QML is designed to work with C++. As a result, it should be relatively easy to build an app that runs on Mac and Windows, and iOS will accept C++, so I can't see a lot of roadblocks there. But I'm confused about Android. I see folks talking about building an Android app using QML, but they seem to still be using java; I gather it uses the NDK in the background.
But if you write an application that has QML for the front and, and C++ for any guts not covered by QML, can it work on Android? Or do you need to rewrite the C++ piece in java? The app is not a simple one, so we are going to have to provide some logic outside of QML, at least, it sure looks that way. While we might save time and $$$ by using QT to not have to go native on the desktops and iOS, I see a problem with Android down the road.
But if you write an application that has QML for the front and, and C++ for any guts not covered by QML, can it work on Android? Or do you need to rewrite the C++ piece in java?
It really depends. You may need to go through the Java interface where the Android platform does not provide direct and public API for certain functionality. One example is low-level IO operations, like writing the serial port for usb-serial devices, but there is more to it.
In general, what Qt modules and third-party software based on Qt do is to use the QAndroidExtras add-on module introduced in Qt 5.2. This will allow easy backend integration into your C++ logic.
With that in mind, you could hide the Java implementation details in the background while you still maintain the C++ interface to QML. Therefore, it should just work that way.
Please see the following documentation to get the grasp of it:
Qt Android Extras
Here you can find one of those nice examples:
Qt Notifier - Demonstrates calling Java code from an Android application.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
:) When you write a iOS App, in order to use the UI like buttons. you have to write it in Objective-C. (Java on Android). I was wondering if anyone had any thoughts on the technical reasoning behind this. Why they might of done this. As you can write apps in C++ on iOS so I've never fully worked out why they didn't expose a way of making the UI in that. (Ignoring the fact that this is how they did it on the Mac).
Note: I know you can write apps in c++ for Android but the question is more why is the main UI i.e buttons etc forced to be written in a dynamic language for these platforms, why not expose access to it thorough C++ without having to write a crude wrapper or binding layer yourself.
I'm guessing that when the original framework engineers were working on their respective operating systems, cross-platform desires like UI support in a different language like C++ was at the bottom of their concerns. You'll have to realize that when deadlines loom, all of the features are prioritized only what is considered most important is made to work. Everything else is a consequence of that.
In the case of iOS, Objective-C is the language of choice for the OS that Apple uses. All of the MacOS app developers were writing in Objective-C so their developer based was in familiar territory.
In the case of Android, Java was already a popular language, with existing open source tooling and libraries (Eclipse IDE, Apache Harmony), so presumably they decided to use Java as the first class language for app development with apps running in a VM as a consequence. Alternatively the decision may have been VM first for the sandboxing of apps and Java was picked as the language for app developers. Or some other reason.
In either case any attempt to add in additional languages now that both are in the hands of customers means design decisions and trade offs along with a host of other questions like: how to add it in without breaking existing APIs, how to support it along with new features, how to test, etc. etc.
As you see more and more software, you'll realize that lots of stuff is just arbitrary or made sense at the moment of when it was designed.
iOS does expose a C API for drawing UI components; it's called Core Graphics.
Because the view itself is written in Objective-C, or Java, respectively. When in Rome, do as the Romans do.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm looking into porting an application called ygopro (source code here) to Android. I was just wondering if anybody can help me out by telling me what would be the best way to go about doing this? I would prefer to not spend more than about 60 hours on it and I certainly don't have the time to go through and rebuild everything from scratch. The code is in C++ and there are about 5,500 Lua scripts to do various things. Is there any easy way I can port this?
First, you'll note that the graphics library used by this project is based on has been ported to android.
There are two demos available for that project. Those will show you how to write an android application that uses this library. I suggest you essentially hack your projects source into the framework they provide.
In terms of Lua, again you'll want to use an existing port. Many of the Lua ports are oriented towards allowing access to LUA from Java via JNI, but you just want a Lua shared library out of them to link to from your C++ code. You will probably want something like AndroLua rather than the Android Scripting Environment. Pretty much, add all the folders in it's jni folder to your Android.mk includes, add it as a library, and you'll be good to go.
In terms of actual porting, I'm assuming that the project currently compiles happily under GCC. If that is the case, as you try to build it, it will complain about functions that are platform specific, and you will have to replace these. That should be manageable, if you are slowly adding code to the graphics framework demo as suggested. Beyond that, some libc functions are missing, but generally only rarely used ones.
Hope this helps. It goes without saying that you should complete some Android Native tutorials before starting. This project is more than a weekend.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I'm going to develop an application for iPhone (iOS) and Android. It should run as a unix daemon gathering data and send it using a TCP/IP socket.
We already have a c socket util written in Windows. My thought is to OS cross compile for BSD and Linux and then use it on iOS and Android.
Ive looked a bit at "Android NDK" and guess it should work on Android.
Would that be possible on iPhone iOS or can it only be done in Objective-C?
In case of a GUI layer "on top" of the daemon - would it make sense to reuse the c socket util and the use Objective-C and Java for iOS and Android respectively - with some kind of communication between.
Finally, I prefer c++ - is that possible on iOS also?
First of all, Android code is written in Java so you are just making your life hard by writing your daemon in C. If you look in Android Fundamentals you will see that it is straightforward to have a part of your application that runs as a service.
IOS is even more restrictive than Android because it does not support Java at all. However you might be able to do what you need using XMLVM to compile Java for the iPhone. If your server is not very complex it would probably be easier to just rewrite it in Objective C.
You can call C/C++ code directly from Objective-C code on iOS. It's even easier to integrate C/C++ code on iOS than on Android, where you need a very syntax specific JNI layer between Java and C++.
I would say that C/C++ is MORE native on iOS than on Android. C/C++ files can be added directly to the XCode project, and will be compiled with CLANG.
I am adding this as an answer because I believe the other answer to be mostly wrong, including the comments underneath it.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Is there a Haskell interpreter (with standard libraries) that can be installed on Android?
So that someone with an Android device can do some Haskell exercises on an Android device: write and run some example code in Haskell.
Hugs is written in C and quite portable. It should be possible to port it to Android.
Taking a note from imz, all you need is
ConnectBot or similar
A remote machine with
Vim, Emacs, or similar
runghc / ghci / hugs / yourfavoritehaskellinterpreterorcompiler
It's not as solid as a dedicated app or scripting layer would be, but honestly, for your use cases, it would provide almost exactly the same functionality as those options (if not more). And it would be just as "mobile" as a website (depends only on the uptime of the host and the connectivity of the client).
You can use tryhaskell.org from your mobile browser. It will accept any valid expression, but keep in mind that defining your own data types won't be possible.
For some negative information, all the work I've seen for GHC on Android (such as http://ipwnstudios.com/) is based on cross-compilation, rather than building GHC for android or ARM.
I just found IDEone in the Android Market, which sends your code to an online service. It works, but programming on Android isn't much fun. Btw: In case you don't want to register see BugMeNot
Surprisingly, I couldn't uncover any existing Haskell interpreter for Android.
But here are some instructions for writing your own interpreter for the Scripting Layer on Android. That's assuming you're willing to try mapping the haskell functions on top of the Java android ones (which is not a perfect solution, I know). You'll also want to refer to their scripting layer written for Scala, because that's the one that comes closest to Haskell (which is not very close I admit).
Otherwise, there shouldn't be any reason why any of those Haskell implementations couldn't be directly compiled for Android using the NDK. As long as they're written in C, they should work on Android. For C++, that's a little bit more tricky since Android doesn't have all the C++ headers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
we made a quit big iOS application with 2000+ objective c classes. I am wondering there is a best practice guide to port it to Android ? Currently I am looking at Visual Paradigm (UML) which reverse engineers objective c files to UML. Like Enterprise Architect it also allows me to generate code(headers + declaration) for another popular language like java or c++. Are there any other approaches yet ? Also, as our app is heavily using the UINavigation and UIView controllers, I am wondering there is similar model and implementation on Android.
Thanks so far, guenter
In all honesty, I think that what you are planing is just going to make for crappy code that will be insanely hard to maintain. I realize it sounds like a lot of work, but its gonna be easier in the long run, I would just "port" the concept of the app to android and write it from the ground up.
The Apportable SDK
It cross-compiles Objective-C applications to Android, without extensive changes to the original codebase. Instead of translating the code to Java, Apportable cross-compiles your code to run directly on the Android device’s processor, bypassing the Java runtime, resulting in speed and performance that rivals the iOS version.
The platform has been tested on Apportable’s library of over 150 devices and in the wild, where Apportable-powered apps have received 5-star reviews on thousands of devices.
check out the sdk here
AFAIK there is no automatic tool to convert Objective-C to Java. There is java2objc that does the reverse.
Here are some official tips for porting Objective-C to Java: http://www.nextcomputers.org/NeXTfiles/Software/WebObjects/Guides/PortingObjectiveCtoJava.pdf
I'm not an iOS expert, but AFAIK iOS does not have layout managers - it uses XIB/NIB to do layout (or dynamically in code, which is not recommended). On Android there are layout classes which are primarily used to support different resolutions. Also, layout is declared via XML files.
So it seems there is a lot of hand-coding in front of you. Since a project is quite large, I'd get a help of an expert that knows both Android and iPhone.
For going from C or C++ to Android you are probably best of using the NDK. The problem is that I don't think this is possible (at least, not directly?) for Objective C.
I think it might be best to try and go to C, and then use the NDK to make it into an app for Android. Going from your code, trough UML to JAVA sounds like a much harder option.
just to let you know how the story did end up, I kept using Sparx Enterprise Architect and have my design, architecture and documentation well under control, for all platforms finally except for JavaScript. Its a bit tedious when integrating new features but in an enterprise environment it saved me a lot of time. We are working on iOS, Desktop(Web2.0/HTML5), Android, Blackberry, Symbian and some router systems. To get rid of platform specific things, I introduced always an additional layer. Seems to work for our products so far.
Thanks to all again, g.
MyAppConverter service helps to convert native iOS mobile apps instantly to native Android app, it's not focused mainly on the look and feel, and UI interaction of your app. That means it don't replicate your application as it is. Instead, MyAppConverter make all changes to make a project suitable for the development of an Android application.
MyAppConverter currently support only iOS to Android conversion and objective-c to swift.