Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Native UI — Gideros Forum

Native UI

OZAppsOZApps Guru
edited July 2013 in General questions
Do the GiderosLab experimental code require any particular version? I get the error message

Uploading finished.
userdata: 0x52f8e4c0
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
stack traceback:

and I tried with several versions but the same error message.
twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps

Comments

  • ar2rsawseenar2rsawseen Maintainer
    @OZApps for Android most probably not. I assume you are referring to Native UI/
    If yes then it is really, really, REALLY an experiment and not yet expected to work correctly (but for some reason runs quite good on my old phone LG Optimus P500 Android 2.3) :)

    We've spent this whole week designing new approach, from scratch, that would involve Native Bridges for both Android and IOS and UI libs on top of them and will post and update when something workable comes up. :)

    About posting feedback, the well, there is a generic Gideros Labs thread:
    http://www.giderosmobile.com/forum/discussion/3437/gideros-labs

    And there should be created separate thread for each project, if there is one already, you will see a link in the Labs project's page to a Forum thread.
    If there are no threads, you can create them (like this one) and I will then add it to the Labs page.

    I will also be creating threads (if it does not exist already) when I have something announcable to tell about specific project :)
  • ar2rsawseenar2rsawseen Maintainer
    And you get this error for the provided example project?
  • yes, running on a Samsug Galaxy II
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • ar2rsawseenar2rsawseen Maintainer
    Well the most painful problem on Android is threading, because all UI stuff should be run on UI thread. And I thought that I've achieved something like that (at least as I thought I did, because it was working on my mobile), but obviously not.
    Of course you can poke around the example project to see if there is something specific that causes this, but only if you want to play with it, because as I said, we are doing complete redesign from scratch which would hopefully allow us better to fix such problems :)
    +1 -1 (+2 / -0 )Share on Facebook
  • @ar2rsawseen,
    I can wait, i think it is fine to wait for the new changes/revamp. I was looking for the Native UI on Android to be able to work complete work on a non-game app that relies on creating data.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • @ar2rsawseen and @OZApps
    I really want Native UI on Android too. I am using Gideros to create business app that need many input form.

    Likes: SinisterSoft

    Coming soon
    +1 -1 (+1 / -0 )Share on Facebook
  • @vitalitymobile, I am also waiting for the native UI, I can use Wax for iOS but need an easier way for Android. So I am also waiting for that.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
    +1 -1 (+1 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    Made nice progress on Native Android bridge today, but still quite far from UI (again the need to run on UI thread), unfortunately won't be able to work this weekend, have other plans, but basically I hope we could be done with events and threading next week and might have something presentable.
    +1 -1 (+2 / -0 )Share on Facebook
  • @ar2rsawseen, since the NativeUI is such a big deal for a few developers, take your time, as this would be a very critical/crucial part of the expectations. If it is rushed and dodgy/buggy, it wouldn't be a good thing.

    However, hope you get this done soon ;)

    Would there be a common arching plug-in that works for Android/iOS using the same API or would it be different for each platform?
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • edited July 2013
    @OZApps for me the hardest thing is native input text.
    Other widgets like button, scrollview, radio button... maybe can "simulate" in LUA language so can use in both platform..
    @ar2rsawseen, please, please bring NativeUI to us as soon as posible :P
    Coming soon
  • OZAppsOZApps Guru
    edited July 2013
    @VitalityMobile, one way to manage a workaround is to have a text place holder and each time someone taps the placeholder, you can pop up the TextInputBox, (which is basically an alertView with a textbox), maybe not very professional but would work cross platform.

    If we could embed a HTML page, we could have it with the form. Hint Hint @ar2sawseen / @Atilim
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
    +1 -1 (+1 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    @OZApps would you mind if I renamed this thread and made it official NativeUI thread?
  • It's ok, you can rename it..
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • @OZApps would you mind if I renamed this thread and made it official NativeUI thread?
    better to create new thread else @ozapps will end up with lot of unwanted notification just my opinion

    :)

  • ar2rsawseenar2rsawseen Maintainer
    @OZApps if that will bother you, you can let me know and we'll change the thread :)
    But basically I'm getting ready to push our own Android Bridge with UI lib, only need to work out some bugs, hopefully will do it today and could post an update to the Labs on weekend :)
    +1 -1 (+2 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    edited July 2013
    So I updated the Native UI project on Gideros Labs. It includes Native Bridge for Android and Native UI lib wrapped around the bridge.
    Bridge and UI examples and some notes are available within the download package.
    Currently NativeUI supports:
    • Android Toast
    • Buttons
    • Checkbox
    • Toggle Buttons
    • Slider
    • Progress bar
    • Activity indicator
    • Text input
    • Web view
    • Video view
    • Alert Dialog
    • Options Dialog
    • Time Picker
    • Date Picker
    Some notes on Native UI
    • Currently Native UI is Android only and API and provided elements may differ for IOS systems
    • All UI elements are under ui. namespace, like: "ui.Button"
    • All UI elements are Gideros classes and should behave like one
    • All native elements underneath are hidden and wrapped
    • You should be able to set positions and dimensions of elements (except the dialogs)
    • Set positions and dimensions should comply with Gideros Autoscaling automatically, so they will automatically be scaled accordingly
    • To display or hide UI elements use show and hide methods
    If any more elements needed or some functionalities need to existing classes, you can post requests in this threads.

    Now excuse me, but I'm tired as hell and can't type no mo..... :)
    +1 -1 (+9 / -0 )Share on Facebook
  • Progress update on this? Im sure this would streamline many developers app creation and tedious UI coding including mine! Glad to see it in the works.
  • Yes currently a bit stuck on ios side, but keeping that in mind while designing the better approach ;)

    Likes: ricvieira

    +1 -1 (+1 / -0 )Share on Facebook
  • I know this is marked as "Experimental," and I read the definition of what that means, but I'm wondering if that's only because the IOS side isn't ready? Would it be okay to use it for Android? I'm actually test-writing an app in different frameworks: Appcelerator, C*SDK, and would like to try Gideros, but I really want a native slider and don't want to pay for Gideros and find out that this feature really isn't ready. Also, does it respond to more touch events? I see onChange in the example.

    This is more of a business-type app and I really like the functionality in Appcelerator, but I really like the support for ad networks and IAP in Gideros and C*SDK (but don't like the lack of native controls C*SDK).
  • @ricsmo Android Native bridge seems stable and works on all devices we tested, it is mostly in experimental stage yes because of IOS and because API may yet change drastically, this was only the first shot.

    But still, would I use it for production? To take single native control element for a game, probably yes, but making full business app all from native elements, probably not yet.

    What you might consider using is:
    http://www.giderosmobile.com/forum/discussion/4208/widget-candy-for-gideros/p1
  • ar2rsawseenar2rsawseen Maintainer
    @achimeno unfortunately not :(
    What situation are you having?
  • I'm moving from jvbridge to Native Bridge, calling Java funtions from LUA runs perfect, but I have some callbacks from Java to migrate to:

    Example:
    LUA
    local gopenkit = native.getClass("com.giderosmobile.android.plugins.openkit.GOpenkit")
    gopenkit.openLoginDialog()
    Java
    	public static void openLoginDialog()
    	{
    		OKLoginActivity.setActivityHandler(new OKLoginActivityHandler() {
    			<a href="https://forum.gideros.rocks/profile/Override" rel="nofollow">@Override</a>
    			public void onLoginDialogComplete() {
    				OKLog.v("Finished showing the OpenKit login dialog");
    				//jvbridge.callLua("OPENKIT_ON_DIALOG_COMPLETE", new JVBridgeParams());
    				//??????????????????????????
    			}
    		});
     
    		Intent launchOKLogin = new Intent(sActivity.get(), OKLoginActivity.class);
    		sActivity.get().startActivity(launchOKLogin);
    	}
    @ar2rsawseen Have I another way to explore?
    Thank you
  • ar2rsawseenar2rsawseen Maintainer
    edited March 2014
    Hmm, you could achieve that using proxies.
    Theoretically you could get without java code at all.

    This one could look like this:
    --you need to get the activity to lua, may create custom 
    --function or use internal openkit commands, I just don't know the api
    --getLoginActivity function does not really exist, just for exmaple
    local OKLoginActivity = getLoginActivity()
     
    --create proxy event
    local eventProxy = native.createProxy("io.openkit$OKLoginActivityHandler", {onLoginDialogComplete = function()
        --this function will be executed upon event
        -- you can dispatch another lua event or call your function here
    end})
    OKLoginActivity:setActivityHandler(eventProxy)

    Likes: achimeno

    +1 -1 (+1 / -0 )Share on Facebook
  • Works fine.

    My final code:
    local eventProxy = native.createProxy("io.openkit.OKLoginActivityHandler", {onLoginDialogComplete = function()	
    			openkitLUA:submitScore(Utils:getUserScore())
    		end})		
    local gopenkit = native.getClass("com.giderosmobile.android.plugins.openkit.GOpenkit")
    gopenkit.openLoginDialog(eventProxy)
    Thanks @ar2rsawseen

  • Have a try with textinput. Crashes for me sometimes(pretty often) during input text.
    07-25 11:15:11.761 9177-9177/? E/KeyboardInfoUtils: getInstance start
    07-25 11:15:11.761 9177-9177/? E/KeyboardInfoUtils: sendSIPInformation state:6  isAbstractKeyboardView : true
    07-25 11:15:11.761 9177-9177/? E/KeyboardInfoUtils: sending null keyboardInfo as SIP is closed
    07-25 11:15:11.761 32595-32609/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 32609 (GLThread 220770)
    07-25 11:15:11.761 9177-9177/? E/SamsungIME: resetNeedToLoadHwrLibrary : 0
    07-25 11:15:11.771 9177-9177/? E/SamsungIME: lang.getLanguageCode():en, lang.getCountryCode():US
    07-25 11:15:11.771 9177-9177/? E/SamsungIME: lang.getLanguageCode():ru, lang.getCountryCode():
    07-25 11:15:11.771 9177-9177/? E/SamsungIME: sendInputLanguage() : ru_RU, en_US;ru_RU;
    07-25 11:15:11.781 9177-9177/? E/SamsungIME: lang.getLanguageCode():en, lang.getCountryCode():US
    07-25 11:15:11.781 9177-9177/? E/SamsungIME: lang.getLanguageCode():ru, lang.getCountryCode():
    07-25 11:15:11.781 9177-9177/? E/SamsungIME: sendInputLanguage() : ru_RU, en_US;ru_RU;
    07-25 11:15:11.851 9177-9177/? E/SamsungIME: <AbstractKeyboardView> - onDraw() called
    07-25 11:15:11.871 2242-2242/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    07-25 11:15:11.871 2242-2242/? A/DEBUG: Build fingerprint: 'samsung/a5xeltexx/a5xelte:6.0.1/MMB29K/A510FXXU3BPID:user/release-keys'
    07-25 11:15:11.871 2242-2242/? A/DEBUG: Revision: '4'
    07-25 11:15:11.871 2242-2242/? A/DEBUG: ABI: 'arm'
    07-25 11:15:11.871 2242-2242/? A/DEBUG: pid: 32595, tid: 32609, name: GLThread 220770  >>> com.player <<<
    07-25 11:15:11.871 2242-2242/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    07-25 11:15:11.891 2242-2242/? A/DEBUG:     r0 00000000  r1 ee9114f8  r2 00000008  r3 f49e8ebc
    07-25 11:15:11.891 2242-2242/? A/DEBUG:     r4 e1167f48  r5 00000000  r6 f49636c0  r7 dd862da0
    07-25 11:15:11.891 2242-2242/? A/DEBUG:     r8 ee6bf3c0  r9 00000001  sl 00002330  fp e116e790
    07-25 11:15:11.891 2242-2242/? A/DEBUG:     ip ee911048  sp ee6bf2e8  lr f6efeaab  pc f32b5398  cpsr 60070010
    07-25 11:15:11.901 9177-9177/? E/SamsungIME: <AbstractKeyboardView> - onDraw() called
    07-25 11:15:11.921 2242-2242/? A/DEBUG: backtrace:
    07-25 11:15:11.921 2242-2242/? A/DEBUG:     #00 pc 00013398  /mnt/asec/com.player-1/lib/arm/libnative.so
    07-25 11:15:11.921 2242-2242/? A/DEBUG:     #01 pc 0000fb70  /mnt/asec/com.player-1/lib/arm/liblua.so
    07-25 11:15:11.921 2242-2242/? A/DEBUG:     #02 pc 0000eae8  /mnt/asec/com.player-1/lib/arm/liblua.so
    07-25 11:15:11.921 2242-2242/? A/DEBUG:     #03 pc 000101b8  /mnt/asec/com.player-1/lib/arm/liblua.so
    07-25 11:15:11.921 2242-2242/? A/DEBUG:     #04 pc 000102e0  /mnt/asec/com.player-1/lib/arm/liblua.so
    07-25 11:15:11.921 2242-2242/? A/DEBUG:     #05 pc 000103bc  /mnt/asec/com.player-1/lib/arm/liblua.so (lua_getfield+76)
    07-25 11:15:11.921 2242-2242/? A/DEBUG:     #06 pc 00014190  /mnt/asec/com.player-1/lib/arm/libnative.so (_ZN11NativeProxy8onInvokeEPKciP13gnative_ValuePi+108)
    07-25 11:15:11.921 2242-2242/? A/DEBUG:     #07 pc 0000fe84  /mnt/asec/com.player-1/lib/arm/libnative.so (_ZN7GNative12invokeMethodEP8_jstringP13_jobjectArrayS3_x+604)
    07-25 11:15:11.921 2242-2242/? A/DEBUG:     #08 pc 00040a15  /data/dalvik-cache/arm/mnt@asec@com.player-1@base.apk@classes.dex (offset 0x2a000)
    07-25 11:15:12.461 2242-2242/? A/DEBUG: Tombstone written to: /data/tombstones/tombstone_01
    07-25 11:15:12.461 2242-2242/? E/DEBUG: AM write failed: Broken pipe
    07-25 11:15:12.461 4358-4358/? E/audit: type=1701 msg=audit(1500970512.461:26160): auid=4294967295 uid=10604 gid=10604 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=32609 comm=474C54687265616420323230373730 reason="memory violation" sig=11
    07-25 11:15:12.501 2605-553/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 104)
    07-25 11:15:12.511 2229-2229/? E/lowmemorykiller: Error writing /proc/32595/oom_score_adj; errno=22
    07-25 11:15:12.581 9177-9177/? E/SamsungIME: <AbstractKeyboardView> - onDraw() called
    07-25 11:15:12.631 2605-3021/? E/InputDispatcher: channel ~ Channel is unrecoverably broken and will be disposed!
    07-25 11:15:12.681 9177-9177/? E/SamsungIME: <AbstractKeyboardView> - onDraw() called
  • Hey guys!
    Does 'Native' plugin work nowadays?
    What is the syntax?
    I've tried to copy code from this article, it doesn't work:
    local toast = ui.Toast.new("test", 100)
     
    --button widger
     
    --Timer.delayedCall(1000,function()
    local button = ui.Button.new("Text")
    button:show()
     
    button:setWidth(100)
    button:setHeight(100)
    button:setPosition(100, 100)
     
    button:addEventListener("onClick", function(self)
    	print("showing toast")
    	ui.Toast.new("Test")
    end, button)
     
    --checkbox widget
     
    local chk = ui.CheckBox.new()
    chk:show()
    chk:setPosition(300, 100)
     
    chk:addEventListener("onStateChange", function(e)
    	print(e.state)
    end)
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+1 / -0 )Share on Facebook
  • edited September 2018
    @Apollo14 Yes it is still alive :)
    Here is quick tutorial show the android native toast
    1. Create new Gideros project
    2. Right-click to Plugins and check Native
    3. Build to android studio and export or export from Gideros Studio the apk with keystore (Do not use debug as it may be errors like this: http://forum.giderosmobile.com/discussion/5392/android-l-lollipop-doesnt-like-gideros)
    4. Enjoy
    5. Or you can download project I make for you



    zip
    zip
    NativeAndroid.zip
    2K

    Likes: Apollo14

    Coming soon
    +1 -1 (+1 / -0 )Share on Facebook
  • @Apollo14 Yes it is still alive :)
    Here is quick tutorial show the android native toast
    1. Create new Gideros project
    2. Right-click to Plugins and check Native
    3. Build to android studio and export or export from Gideros Studio the apk with keystore (Do not use debug as it may be errors like this: http://forum.giderosmobile.com/discussion/5392/android-l-lollipop-doesnt-like-gideros)
    4. Enjoy
    5. Or you can download project I make for you

    Thanks @vitalitymobile !
    It seems that native UI elements work, except webview! That's good!
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+2 / -0 )Share on Facebook
Sign In or Register to comment.