1

I have a CodenameOne app I've deployed to iTunes app store and Google play and now I'm looking to put out an UWP version.

On iOS, a "back" button appears at the top of each form where I can go "back", but on Android it is not there since we have a hardware back button. I just built and ran my app on UWP for the first time and there's no back button in the title bar like iOS and the UWP container has no apparent "hardware" back button outside of the app itself.

Can I enable the iOS "back" button in UWP builds without enabling it in all platforms (like android where the hardware button handles "Back" elegantly)? Is there another way to enable "back" functionality elegantly in UWP Apps? I am completely new to Windows UWP app development.

Java-K
  • 497
  • 2
  • 11
  • Please refer the similar question about the [back button](http://stackoverflow.com/questions/30597585/windows-10-uap-back-button). – Jayden Apr 20 '17 at 03:01
  • @Jayden, Thanks, that looks like a good resource if i need to get into native UWP apps, but this question is very specific to the Codename One framework, not general UWP development. Although I have the option of writing native code for UWP in the framework, I want to remain in the Java based Codename One framework as much as possible for this project. – Java-K Apr 24 '17 at 11:26

3 Answers3

2
  1. I have added an issue to improve UWP to detect presence of hardware back button. https://github.com/codenameone/CodenameOne/issues/2099

  2. You can override the showBackCommandOnTitleBool only in UWP by selecting "OVerride in Platform" in the Theme editor. Then select "Windows Phone 7" (at least I think that should work... we need to add UWP to this list). Then set the theme constant there.

Override in platform

steve hannah
  • 4,586
  • 11
  • 18
  • Thanks for that pointer @steve, The only challenge I have with this in the old GUI Builder (don't know if it's different in the new Designer) is that it makes the entire theme unique to UWP, so any changes to the rest of the styling or theme will need to be manually copied to the UWP version of the theme. It's the "right" way to do multi-platform settings, it's just unfortunately not very granular. – Java-K May 07 '17 at 18:12
  • 1
    I neglected to mention that you can also set theme constants from code. Using `UIManager.getInstance().addThemeProps(myHashtable)`. Just add the `@ showBackCommandOnTitleBool` key to the hashtable with `Boolean.TRUE` value. Use `Display.getPlatformName()` ("win") to test if you're on windows. – steve hannah May 08 '17 at 14:12
0

Try setting the showBackCommandOnTitleBool theme constant to "true" in your theme. That should force it to appear.

steve hannah
  • 4,586
  • 11
  • 18
  • is it possible to detect the UWP platform and set the constant in code only for UWP? I don't want back buttons on the task bar on andrond where they are redundant. – Java-K Apr 23 '17 at 20:36
0

Code:

Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.Visible;

Ann Yu
  • 137
  • 1
  • 4
  • thanks for your UWP-specific answer, but I'm actually looking for how the Java-based CodenameOne Framework enables this. – Java-K Apr 24 '17 at 11:29