Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Mobile / Android

Multi-OS Engine Actions Menu

5.00/5 (2 votes)
1 Mar 2016CPOL3 min read 8.9K  
This article takes a simple app and demonstrates the use of the above mentioned sub items.

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Intel® Developer Zone offers tools and how-to information for cross-platform app development, platform and technology information, code samples, and peer expertise to help developers innovate and succeed. Join our communities for Android, Internet of Things, Intel® RealSense™ Technology, and Windows to download tools, access dev kits, share ideas with like-minded developers, and participate in hackathon’s, contests, roadshows, and local events.

The new update of Multi-OS engine provides "MOE Actions" context menu item for Android Studio. The item contains sub items namely Synchronize to Xcode, Synchronize to Java, Generate Bindings. This article takes a simple app and demonstrates the use of the above mentioned sub items.
To start with let us create a Multi-OS Engine module with Single View Application Template with storyboard.

Synchronize to Xcode - To generate Objective C UI controller stubs from Java implementation for working in Xcode Interface Builder.

  1. At the module level – right click and select "MOE Actions". Click on "Synchronize to Xcode".

    Image 1
  2. To view the generated Objective C controller files, change the view of the app to Project.

    Image 2
  3. You can see the the Objective files generated under Xcode folder.

    Image 3

Synchronize to Java – Generate or update Java UI Controller based on changes make in Objective C stubs via Xcode.

  1. Start with opening the project with Xcode. To open project with Xcode - At the module level- right click and click on "MOE Actions". Select "Open Project in Xcode"

    Image 4
  2. Once the project open up in Xcode. Open the storyboard file under resource folder. Add a button to the palette.

    Image 5
  3. Open the assistant editor to associate IBAction of the button to the AppViewController file (control click to the .h file. Save the files in Xcode.

    Image 6

    Image 7
  4. Go back to your Android Studio, on the Xcode folder, right click and under "MOE Actions" click on "Synchronize to Java".

    Image 8
  5. You will see the IBActions associated with the newly added button in your "AppViewController.java" file.

    Image 9

Generate Bindings- Generate or Updates Java classes/interfaces/enums based on Objective C code.

  1. In the same Project, open the project with Xcode again.
  2. Create another storyboard file. To create another storyboard file - Right Click on the project in Xcode and select new fileà User Interface (left panel) à StoryboardCocoa Touch Classes and click on next.

    Image 10
  3. Open the newly created storyboard file. Drag and drop the view Controller on to the storyboard.

    Image 11
  4. Let us create a custom class for the storyboard. Right Click on the project in Xcode and select new fileà Cocoa Touch Classes and click on next.

    Image 12
  5. Name your class and make it a subclass of UIViewController

    Image 13
  6. In your interface builder – change the Custom class of the ViewController to the custom class created in the previous step.

    Image 14
  7. Go back to your Android Studio, Right click at the Project level and under "MOE Actions", click on "Generate Bindings"

    Image 15
  8. You can see the custom class created for you using generate bindings .

    Image 16

Note: The Generate Binding and Synchronize to Java have the same functionality with the following difference- right click on the module to invoke Generate Bindings vs right click on the xcode folder to invoke Synchronize to Java.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)