4

Don't say it can be done, because it definitely can if you don't care too much what the app looks like, and I for one really don't. It definitely can't be done with the standard API, nor probably with Java, a notoriously boilerplatey language.

Now I'm not saying every android app could be compressed down to a few lines, which is obviously false. I'm saying if that's how complicated your app actually is, then that's how much code should be required to make it.

Here's an example: a rot13 app. Two text fields, one of which is read write (to the user) with a callback activated on text change, and the other which is read-only (to the user) and is updated in real time by the callback with the rot13-encoded contents of the read write text field. Now tell me that can't be done with like 20 lines of code.

Another example: display json objects coming off a websocket in real time. Each field goes to a text field on the screen somewhere. 20 lines easy.

As for what functionality exactly is provided, that is determined largely by how much more complicated simple programs like this would be to make if a certain feature were added. All of the features that are included won't be as general as they are in the standard library. For example, the read-write text field in the rot13 example doesn't need to have a callback that is called every time the field is tapped, in order for it to fulfil its basic job, which is to accept text input from the user. It will be impossible to change what the field looks like too. Simple layouts like LinearLayout will be available, but specifying the exact position and size of a widget probably won't be.

That said, all kinds of features could still be included. After all, it is the app that must be simple, and not necessarily the toolchain. (Sort of the python approach, but for android. Python's stdlib is massive.) For sure, scrollpanes, buttons, input text fields, output text fields, radio switches, and check boxes could be included. Static icon widgets and icon buttons chosen out of a short list of standard icons (delete, save, load, sync to cloud, send) wouldn't go amiss either. Arrays of any of the lowest-level widgets should also be possible.

So, ideally as many features as possible, while not violating the purpose, but even just basic stuff would be cool. All kinds of totally awesome hackery could be done with apps like this.

Are there any toolkits out there that come close to this?

This is ultimately secondary, but I'd like to get an app working with nothing but a text editor and the right toolchain. There's no reason a 2-gig IDE should be a prerequisite.

Another example just for fun: listen for some kind of network event and generate an android notification if it's received. 20 lines easy.

Concrete example: rot13.sap, or whatever the file extension would be. I went with Simple Android Program.

layout:
    vstack:
        hstack:
            text "INPUT:"
            intext in
        hstack:
            text "OUTPUT:"
            text out

def in(s):
    out = rot13(s)

def rot13(s):
    return ***do the rot13 thing.***

Then $ sap rot13.sap would produce rot13.apk.

  • 1
    There is a Python interpreter for Android, but if I understand correctly you want to generate a complete Android app, so that would not be OK, right? – Nicolas Raoul Feb 7 '18 at 7:00
  • Well, if an app on the phone is required to run this kind of light app, maybe that wouldn't be so bad. Actually both would be nice. Standalone apps, and apps run from within a host app. Just the python interpreter alone isn't really what I'm looking for. I was thinking simple UI designs too. – enigmaticPhysicist Feb 7 '18 at 19:04
  • "Simple UI designs" can mean very different things to different people, so please explain in the question all of the UI elements you need. Also, will you need to access the phone's camera/speakers/microphone/GPS/network/buttons/etc? – Nicolas Raoul Feb 8 '18 at 5:23
  • Elaborated on "simple UI designs" in the question. – enigmaticPhysicist Feb 20 '18 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.