Recommended approach to Android?

271 views
Skip to first unread message

simo

unread,
Feb 14, 2013, 9:03:07 AM2/14/13
to haxe...@googlegroups.com
Hello,

I am about to build an app for android, its not a game, but, a graphical app, will be viewing pages with graphical elements inside, like circles, texts, images, etc ..
So, there will be two parts for the project:

  1. The re-usable part, this will be the haxe code that is related directly to the core functionality of the app, this will be re-usable in other targeted platforms, its not platform related, but it will be compiled for each targeted platform.
  2. The platform related part, and this is what I need to ask about.
Shall I start an android project in Eclipse, and put the reusable part above inside it as a lib? is this a recommended way? if so:
  • Can I compile the NME project (re-usable part) to an android lib? is this possible? or shall I compile to java code, and build the library from the resulted java code?
  • How would app activities communicate with my android targeted lib that was generated with NME project? 
  • How would my android targeted lib communicate with methods inside activities?
The other approach is to build the project totally in haxe, using haxe UI libs like YAHUI and StablexUI, if this is the recommended approach:
  • How would I communicate with android related logic (ex: entities, services ..) ??
I hope I can get support from others who already built android apps with haxe.

Thanks




Cambiata

unread,
Feb 14, 2013, 11:47:23 AM2/14/13
to haxe...@googlegroups.com
Can't give you any answers, Simo. Just want to underline that this is very interesting stuff.
I would definitely prefer some kind of NME extension/connection to the target API (entities, services etc) so that the app could be built in Haxe from the bottom..!

/ Jonas

Hugh

unread,
Feb 15, 2013, 12:21:25 AM2/15/13
to haxe...@googlegroups.com
Hi,
Yes - the android build is already a dll like you want.  Basically, you feed events (mouse,refresh) events into it and it makes some opengl calls.
That said, you have to get the events right, so it is not simple.

The NME project will create some template code to control these events. I suggest creating this code once, but then take control of it yourself (copy it to your eclipse project) an modify/embed it into your larger GUI. You can then build the haxe code an put it in your "libs" directory.

This is along the lines of the "waxe" project where you build you native gui and have the nme render to a window, so you may be able to write a waxe GUI and completely reuse the haxe render code.

Hugh

simo

unread,
Feb 17, 2013, 2:30:06 AM2/17/13
to haxe...@googlegroups.com
Thanks Hugh, Jonas

>The NME project will create some template code to control these events. I suggest creating this code once, but then take control of it yourself (copy it to your eclipse project) an modify/embed it into your >larger GUI. You can then build the haxe code an put it in your "libs" directory.

I am new to haxe world which is full of interesting things and smart people, Is there some tutorial to implement this? at least to help me put things to gather? what would be the compile settings to generate an android lib? 

May be if I handle the events at the android java side, then make a direct call to methods inside the haxe dll? would this possible? but again, how would I write the interface in haxe, that I will be using in android?

>This is along the lines of the "waxe" project where you build you native gui and have the nme render to a window, so you may be able to write a waxe GUI and completely reuse the haxe render code.

I found that wxWidgets on Android dose not exist yet  , I think the above approach is little bit more simpler yet.

Hugh

unread,
Feb 17, 2013, 11:36:45 PM2/17/13
to haxe...@googlegroups.com
Hi,
You are not on a well-trodden path here, so I don't think there is much in the way of help.
The haxe->android compiling is conceptually simple: you take haxe code and get a dso.
The complicated part is performed by NME framework.  What you are looking at is outside the NME framework, so I think it is going to be a bit of work to get something going.

Start by running a normal nme project, and then copy the directory containing the "AndroidManifest.xml" file, and try to "open" this in eclipse.
From memory, eclipse confuses "open" "projects" "workspaces" and "create - from existing source" so good luck with that.

Hugh

Chris D

unread,
Feb 18, 2013, 12:42:02 AM2/18/13
to haxe...@googlegroups.com
The ui libs are getting better by the day but I wouldn't say any of them are an out of the box solution yet. 
Given some time and work I think they will be the best option for a skinnable and easy to extend gui.

The other approach is the wicked idea of native ui from haxe like https://github.com/Randonee/Basis

co...@seasonsoftware.com

unread,
Feb 18, 2013, 1:51:17 AM2/18/13
to haxe...@googlegroups.com
Hi, I'm working on Basis.
Right now all I've done with android is build a simple example app and run it in the emulator. I'm currently focused on iOS and will probably be spending more time on android in a couple months. 
However, android is much simpler compared to iOS since there is haxe java (thank you).  Haxe java really does most the work for android. All Basis is doing is creating the android project and doing a little macro magic to create the resources.  If you were to use Basis, externs would probably be the main thing that would need to be added. Haxe java is also in beta so there could be issues there.

BasisAndroid can be found here:

Aaron


--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxelang+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Samir Sabri

unread,
Feb 18, 2013, 2:59:54 AM2/18/13
to haxe...@googlegroups.com
https://github.com/Randonee/Basis looks promising, they have externs for the main ui components, I will experiment with it, thanks

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxelang+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
--
Kind Regards,
--------------------------------------------- 
Samir Sabri
Software Architect& Developer
Jordan-Middle East

Samir Sabri

unread,
Feb 18, 2013, 3:35:14 AM2/18/13
to haxe...@googlegroups.com
Hello Aaron, Just wondering, using BasisAndroid how would I be testing my app while I am developing it? shall I install it on android each time to see the result? or I can target flash to see results while I am working? then I target android when I am ready? will NME do that magic?

co...@seasonsoftware.com

unread,
Feb 18, 2013, 3:53:10 AM2/18/13
to haxe...@googlegroups.com
You would need to test on android since the externs only apply to android. I use the android emulator to test. Currently you need to handle installing the app to the emulator yourself (I use ant to automate it). At some point emulator support will get added.

NME isn't used. Basis creates an android java project which you can then test / debug like any other android project.

Aaron

Samir Sabri

unread,
Feb 18, 2013, 4:08:27 AM2/18/13
to haxe...@googlegroups.com
I see, it seems that its important to write the project core in a way that make it easy to target iOS externs, for example, an interface that exposes the events needed:

IOSEventsManager implements IPlatformEvents
AndroidEventsManager implements IPlatformEvents

then, in my code, I refer to AndroidEventsManager/IOSEventsManager through IPlatformEvents interface, this way it will make switching between platforms easy, encapsulating calling platform oriented externs implementation.

Can I do the same for the UI ? think so?

co...@seasonsoftware.com

unread,
Feb 18, 2013, 5:09:39 AM2/18/13
to haxe...@googlegroups.com
Yeah, that is basically what I've been doing in the regular MVC way.

For the UI I have an interface and mediator for each view. Each platform then implements each view interface which talks to the mediator.

The package structure looks something like this:

someapp.view.login.ILoginView
someapp.view.login.LoginViewMediator

someapp.platform.ios.view.login.LoginView
someapp.platform.android.view.login.LoginView

Jonas Nyström

unread,
Feb 18, 2013, 5:29:34 AM2/18/13
to haxe...@googlegroups.com
@Simo:

Regarding testing, I try my Android solutions first using BlueStacks Android emulator - works on Mac and PC:
http://www.bluestacks.com/
Very handy, just rightclicking the compiled APK to install and run it in BlueStacks.

Samir Sabri

unread,
Feb 18, 2013, 6:42:35 AM2/18/13
to haxe...@googlegroups.com
@Jonas, thanks, its very handy indeed
@coder, I wish you good luck developing your project :-)

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxelang+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages