I am trying to create a module (native service for android) so that my appcelerator application can launch the native service. The service is running fine, and it creates a relativeLayout a system_overlay I am able to set that relativeLayout's background color, but ultimately i want to set its backgroundImage. I have a png that i want to use for that background named: bg_noti
I have tried to do so in my native service class (inside the module project) like so:
String bg_name ="android.R.drawble.bg_noti";
try {
notificationBar.setBackgroundResource(TiRHelper.getApplicationResource(bg_name));
} catch (ResourceNotFoundException e) {
// TODO Auto-generated catch block
Log.v(":::::::::::", "EXCEPTION:"+e);
e.printStackTrace();
}
my understanding is that i need to place the png somewhere in the Titanium app project, but no matter where i put it it doesn't seem to make its way into the compiled app..
i always get the exception that the resource is NOT found.
i was following the example found here: http://developer.appcelerator.com/question/49671/android-r-references-in-appcelerator-module
but they say to place the image in $APP_DIR/platform/android/res directory which doesn't exist.. i tried just creating it... but still doesn't work..
can someone please inform me as to where i am actually suppose to place this image in the titanium app project so that the module can reference it..
You use the
getApplicationResource
method but you want an Android resource. You should try to use thegetAndroidResource
method :You should also change
bg_name
(android.R.drawable.bg_noti
todrawble.bg_noti
).