Prior to the AIR4.0 version, r* could not be used within ANE, and operation Resources could use only Getresourceid (). This is especially frustrating for the SDK.
However, after 4.0, you can use r* to access resources directly by specifying platform.xml at the time of packaging.
Adobe website RELATED links
A video of the stick
One of the two points to note
1 ' Android Project works to be set as library
2 ' shot jar Package Delete r* related class One-click Script see: Ane from Getting started to mastering---One-click Package ane
Actual combat:
STEP1 Create an Android project, note that select Application, do not select the library because the library does not generate the corresponding file structure and Androidmanifest.xml
STEP2 Change Project for library
Step3 adds or changes a fun to access a resource through r*, which is accessed R.string.hello
Packagecom.testzone.t2;Importandroid.content.Intent;ImportAndroid.widget.Toast;ImportCom.adobe.fre.FREContext;Importcom.adobe.fre.FREFunction;ImportCom.adobe.fre.FREObject; Public classT1anefunImplementsfrefunction {@Override PublicFreobject Call (Frecontext frecontext, freobject[] freobjects) {Toast.maketext (Frecontext.getactivity (),"Call T1", Toast.length_short). Show (); Try{String Hello=frecontext.getactivity (). getString (R.string.hello); Toast.maketext (Frecontext.getactivity (),"Hello is:" +Hello, Toast.length_short). Show (); } Catch(Exception e) {toast.maketext (Frecontext.getactivity (),"Error is:" +e.tostring (), Toast.length_short). Show (); }return NULL; }}
STEP4 Compiling the jar package
This operation is described in the---simple whatever of the ANE from getting started to mastering
STEP5 Delete all the parts of the jar package about r*
STEP6 Copy the jar package to the ANE build directory
Create Platform.xml under the STEP7 Ane build directory
<Platformxmlns= "http://ns.adobe.com/air/extension/19.0"> <packagedresources> <Packagedresource> <PackageName>Com.testzone.t2</PackageName> <FolderName>Res</FolderName> </Packagedresource> </packagedresources></Platform>
Please refer to the Adobe website for the specific meanings of these links
STEP8 Modifying package parameters Join
-platformoptions Platform.xml
For details, refer to the ane from getting started to mastering---One-click Package ane
ANE from getting started to mastering---Accessing resources using r*