Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Android: I wish somebody warned me about this!

Android: I wish somebody warned me about this!

Scheduled Pinned Locked Moved The Lounge
androidjavarubydesignhelp
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cp Coder
    wrote on last edited by
    #1

    I am getting to the stage of conquering Kotlin where I start feeling comfortable regarding myself as a Kotlin coder. Kotlin, of course, is the primary tool for writing code for the Android platform. Yes, Java can code for Android as well, but Java is getting long in the tooth. A couple of days ago, I had to code a dialog box with CANCEL and PROCEED buttons, where the user can confirm some choice (or cancel out of it.) The idea was for the UI to stop and wait for user input. But I tried everything and there was no way to stop the UI. It would pop up my dialog, but instead of waiting it went on its merry way, continuing to execute statements. It nearly drove me nuts, until in desperation I googled the problem. And there was the answer: Some Android expert said there is no way to stop the Android UI, as everything in Android is async. Aaaargh! I wish somebody told me that! I bought 3 books on writing Kotlin code for Android and not one shared that little gem with me. It seems you may have to make some fancy moves while waiting for user input, to make sure the UI doesn't wander off and do something stupid!

    Get me coffee and no one gets hurt!

    R L D 3 Replies Last reply
    0
    • C Cp Coder

      I am getting to the stage of conquering Kotlin where I start feeling comfortable regarding myself as a Kotlin coder. Kotlin, of course, is the primary tool for writing code for the Android platform. Yes, Java can code for Android as well, but Java is getting long in the tooth. A couple of days ago, I had to code a dialog box with CANCEL and PROCEED buttons, where the user can confirm some choice (or cancel out of it.) The idea was for the UI to stop and wait for user input. But I tried everything and there was no way to stop the UI. It would pop up my dialog, but instead of waiting it went on its merry way, continuing to execute statements. It nearly drove me nuts, until in desperation I googled the problem. And there was the answer: Some Android expert said there is no way to stop the Android UI, as everything in Android is async. Aaaargh! I wish somebody told me that! I bought 3 books on writing Kotlin code for Android and not one shared that little gem with me. It seems you may have to make some fancy moves while waiting for user input, to make sure the UI doesn't wander off and do something stupid!

      Get me coffee and no one gets hurt!

      R Offline
      R Offline
      Ron Anders
      wrote on last edited by
      #2

      Not nearly as nuclear, but I found a nice replacement for js alert that is real cool and lightweight but unlike alert, does not stop execution. it's the last statement in the readme.md as if the dev is sorry about it. :doh:

      1 Reply Last reply
      0
      • C Cp Coder

        I am getting to the stage of conquering Kotlin where I start feeling comfortable regarding myself as a Kotlin coder. Kotlin, of course, is the primary tool for writing code for the Android platform. Yes, Java can code for Android as well, but Java is getting long in the tooth. A couple of days ago, I had to code a dialog box with CANCEL and PROCEED buttons, where the user can confirm some choice (or cancel out of it.) The idea was for the UI to stop and wait for user input. But I tried everything and there was no way to stop the UI. It would pop up my dialog, but instead of waiting it went on its merry way, continuing to execute statements. It nearly drove me nuts, until in desperation I googled the problem. And there was the answer: Some Android expert said there is no way to stop the Android UI, as everything in Android is async. Aaaargh! I wish somebody told me that! I bought 3 books on writing Kotlin code for Android and not one shared that little gem with me. It seems you may have to make some fancy moves while waiting for user input, to make sure the UI doesn't wander off and do something stupid!

        Get me coffee and no one gets hurt!

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        UWP is the same way; the methods for their "content dialog" control are .Hide and .ShowAsync().

        "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

        1 Reply Last reply
        0
        • C Cp Coder

          I am getting to the stage of conquering Kotlin where I start feeling comfortable regarding myself as a Kotlin coder. Kotlin, of course, is the primary tool for writing code for the Android platform. Yes, Java can code for Android as well, but Java is getting long in the tooth. A couple of days ago, I had to code a dialog box with CANCEL and PROCEED buttons, where the user can confirm some choice (or cancel out of it.) The idea was for the UI to stop and wait for user input. But I tried everything and there was no way to stop the UI. It would pop up my dialog, but instead of waiting it went on its merry way, continuing to execute statements. It nearly drove me nuts, until in desperation I googled the problem. And there was the answer: Some Android expert said there is no way to stop the Android UI, as everything in Android is async. Aaaargh! I wish somebody told me that! I bought 3 books on writing Kotlin code for Android and not one shared that little gem with me. It seems you may have to make some fancy moves while waiting for user input, to make sure the UI doesn't wander off and do something stupid!

          Get me coffee and no one gets hurt!

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Regardless of Java vs Kotlin, mobile apps in general are non-blocking (bad UX otherwise). That's one of the ways in which they differ from desktop apps.

          Cp-Coder wrote:

          It seems you may have to make some fancy moves while waiting for user input, to make sure the UI doesn't wander off...

          I've yet to have to resort to fanciness. It's mostly just making sure the design is correct and then taking advantage of what the OS already provides.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

          E 1 Reply Last reply
          0
          • D David Crow

            Regardless of Java vs Kotlin, mobile apps in general are non-blocking (bad UX otherwise). That's one of the ways in which they differ from desktop apps.

            Cp-Coder wrote:

            It seems you may have to make some fancy moves while waiting for user input, to make sure the UI doesn't wander off...

            I've yet to have to resort to fanciness. It's mostly just making sure the design is correct and then taking advantage of what the OS already provides.

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

            E Offline
            E Offline
            englebart
            wrote on last edited by
            #5

            And it often drives me crazy… after 35 years of CUA everywhere, mobile OSes decided to change everything to “happens now”. Most mobile OSes have no OK/Cancel to commit a form at a time. It is a field at a time now.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups