damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.43k stars 800 forks source link

accessing resources by aapk index from scripts in .apk #100

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

What should be supported?

In order to make scripts distributed as .apk files behave more like native 
android applications, it would be nice to allow for looking up aapk compiled 
resource index from within the script and use the resources by referencing the 
index.

One such option would be to have a method for each type of resources, like 
below:

droid.getResourceIndexString["name"] translates to R.string.name
droid.getResourceIndexLayount["name"] translates to R.layout.name
droid.getResourceIndexId["myid"] translates to R.id.myid

droid.fullShowIndex(index) displays the contents of precompiled XML.
etc.

Such design would allow for development of GUI using native Eclipse Android 
tools, in addition to all the benefits of the compiled resources like 
compression, simplicity of internationalization and speed benefits.

Original issue reported on code.google.com by zele...@gmail.com on 4 Apr 2012 at 12:14

Copied from original issue: damonkohler/android-scripting#618