Loading...
Logo
Processing Forum
Hi,

I'm working with Android Processing in Eclipse and have encountered a problem. My main class extends PApplet, and that is where I want to have my onOptionsItemSelected method. For some reason PApplet also has a field called R, and since the class extends PApplet, Eclipse gives me an error when I try to access strings.xml through the resources folder. What's the best way to deal with this? Should I just have the method in another class that doesn't extend PApplet?

Thanks

Replies(1)

I see your problem, just viewed some of my work but perhaps try an alteration of the following:

InputStream is = getResources().openRawResource(resId);

So maybe getResources().onOptionsItemSelected(resId);

You will find the resId in the processing.test.filename package, just open R.java for the unique id of your resource. If R.java does not exist, right-click on your main project folder, go to Android tools and fix properties.
Or maybe just calling onOptionsItemSelected() on its owns will work as for get Resources you don't need to specify R in eclipse while in other environments it doesn't know what function its from, even if I include all the same imports.

Let me know how you get it working, and good luck