We reached a lot about the possibility of porting apps that were at that point composed utilizing the Android API. In this snappy instructional exercise, we will walk you through the paces of changing over a basic port android app to iPhone. We will likewise begin with some fundamental points covering the contrasts between Android and code One improvement.
How does codename One change from Android Development?
code One permits Android engineers acquainted with Java to right away from Native applications for Android, Windows, iOS and different stages.
code One has the accompanying extra focal points other than transportability:
- A quick test system - Despite late advances in the emulator. The assembly procedure and application association are still frustratingly moderate on Android
- Standard Java troubleshooting and profiling devices
- Assets are naturally scaled to the diverse DPI's in the apparatuses
- No compelling reason to manage shows and consents (code One consequently recognizes and applies the essential authorizations). See this is certainly Marshmallow perfect too, so consent prompts have verifiably appeared.
- code One shrouds the contrasts between adaptations on Android
- Since code One doesn't bundle GUI XML's into the last item it is harder to figure out a code One application
- Part progressive system (perspectives) is much less complex in code One
- Works with all major IDE's (NetBeans, Eclipse, and IntelliJ/IDEA)
- Comprehensive as a matter of course - no requirement for blending and coordinating various different devices
Designs
In Android, engineers fabricate UIs in XML by settling format perspectives and view components one inside another. These components are interpreted by the compiler and stuck request to dilemma code to them you have to "discover" them by their ID to utilize them. code One contrasts in a few ways:
- You can fabricate code One applications either by means of the GUI developer which utilizes a more customary code generator approach or compose Java source code physically.
- All formats are connected to the Container class basically decoupling design from Container chain of importance
- To peruse more about the diverse sorts of formats and how they can be settled/utilized you can take after the segment on design directors in the designer guide or look at the designs segment in the Javadocs.
Parts
Parts basically fathom an issue with Android which blended Activity and View in a progression making a to some degree complex situation to for element structures.
The idea is intense, yet it isn't versatile, helpful or hearty. Parts get to be superfluous as a result of the much less difficult code One pecking order. Since code One doesn't have a genuine likeness Activity the UI components needn't bother with it either e.g. Tabs work with Container, not Activity.
Numerous DPI's And 9-Patch Layouts
code One backings a multi-picture organize which is generally indistinguishable to the different DPI catalogs normally utilized as a part of Android. Not at all like Android the code One creator device consequently scales the pictures to every one of the resolutions sparing you the need to keep up numerous determination bolster.
The same is valid with code One's 9-section picture fringes. Be that as it may, not at all like Androids extremely expand 9-fix outskirts code One fringes are far less difficult.
code One uses tiling for fringe pictures (rather than scaling) and separates the pictures, it additionally incorporates a picture cutting wizard and inside slices the pictures to 9-pieces.
Exercises
code One has its own lifecycle protest which acts more like an application than the action does for port android app to iPhone, it's to some degree less difficult to program to.
code One backings terminating expectations in spite of the fact that that is, for the most part, Android particular and won't chip away at different stages.
code One has two distinct classes that match the action. The Frame is the top-level part that you can "appear" and move. The primary class for code One itself gets lifecycle occasions like the Activity lifecycle occasions.
Android Specific Attribute
You can conjure "Native" Android code from code One without breaking the versatility of code One. Take after the Native code area in the designer manual foresee how this can be refined, you can likewise observe the how would I video instructional exercise on the subject. You can likewise add things to the show and so on if required by your Native code.
Porting Tool
A while back we declared an open source venture to facilitate the porting procedure cn1 android merchant. This is an extremely fundamental apparatus that just frameworks the new code One anticipate from an Android extend without truly copying the UI or changing the code.
We can clearly enhance this device fundamentally, however, to do as such we have to gage group intrigue which so far has been "disappointing". I will begin by utilizing this apparatus as it is presently to begin rapidly and after that port the code.
The Application
I ported a truly trifling application so it will be anything but difficult to take after. Particularly I picked Swiftnotes whose source code is accessible here.
I picked this application since it is basic. Making the application "beautiful" isn't an objective of this instructional exercise despite the fact that I attempted to make the application look sensibly great while attempting to remain faithful to the first plan.
While concluding, to give you a feeling of where we are heading to port android app to iPhone. I've distributed the final product to Apple iTunes, Google Play and the Microsoft Store and additionally made a JavaScript manufacture which you can see one side here and you can dispatch on a gadget here.