Skip navigation
HungryCatMari
Currently Being Moderated

How to use R.resource in Java from ANE?

Mar 13, 2013 7:26 PM

Tags: #java #ane #nativeextension

Hello,everyone,sorry for my poor English..

I want to ask "What is the appropriate way to manage resource in ANE"??

 

I have exported jar-library,and made ANE then called from Air Mobile.

(I check include-resource-option when I export from eclipse.)

When I debug on device,it seems that the Java's R.resource is overrided by R.resource air made.

 

Forexample,I have added FREFunction returns resource-value.

If I refer and display string.app_name,It shows string.app_name of Air-Project's.

After I added string.test to resouce in Java,and display it in Air,there is no value.

 

What is the appropriate way to manage resource in ANE.

 

Reference:

http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/v ibration.html

 

 

public class Native_xxxxxxx implements FREFunction {

 

    private Resources res;

 

    public FREObject call(FREContext arg0, FREObject[] arg1) {

 

        try {

 

            Activity activity = arg0.getActivity();

 

            res = activity.getResources();

 

            return FREObject.newObject(res.getString(arg0.getResourceId("string.app_name ")));

 

            //return FREObject.newObject(res.getString(arg0.getResourceId("string.test"))) ;

 

            //return FREObject.newObject(res.getString(R.string.test));

 

        } catch ( Exception ex ) {

 

        }

        return null;

 

    }

 

}

 
Replies
  • Currently Being Moderated
    Apr 8, 2013 10:35 AM   in reply to HungryCatMari

    I don't think its a bug with AIR 3.5. I'm using FB 4.7 and the latest Eclipse for the native side and AIR 3.6 overlaid onto Apache Flex 4.9.1. I've created my .ane and my test app runs fine until I request a native side resource. I've unpacked the .ane and it all looks good - my resources are there. I'm making correct calls through context.getResourceId().

     

    Turns out I wasn't stepping back far enough. I next unpacked my apk, and low and behold, when FB packages it up it strips apart the .ane, throws away its resources, and bundles in new ones.

     

    Next step is to find out why. Going to see if Flash Pro CS6 builds bad apk's as well. If so, I suppose I'll try and find docs on adt and aapt and see if I can build batch files to build the apk's myself. Also need to clean my path of any adobe folders, and add the ones I need in the batch files to insure I'm not accessing stuff from an older SDK somewhere. And I'll also check against other SDK's - perhaps my overlay isn't working out like I'd first thought.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points