christian
christian

Reputation: 495

Wasn't able to add resource files to titanium android app

I am building an android app using titanium and I need to add some of resource files(images and other types which usually added in project/res folder of android eclipse project) to the titanium app.

So I tried to copy couple of images - clip_first.png, clip_second.png to [Titanium app folder]/Resources/android/images. But when it's being compiled, the resource files are copied to the correct path but the names are with some suffices.

I attached a screen shot of the project

Is there any way to add them without the suffices? What is the naming changing rules since I saw default.png is also renamed to background.png?

Thanks in advance.

Screenshot of project hierarchy

Upvotes: 0

Views: 244

Answers (1)

TheFuquan
TheFuquan

Reputation: 1787

You should put your resources inside the folder app/assets/android/images/res-{density}/

Example :

app/assets/android/images/res-xhdpi/my_image.png

and then you can assign it as a background image to any view as such:

myView.backgroundImage = "/images/my_image.png";

don't forget the leading backslach on the path.

or using the tss :

"#myView" : {
    backgroundImage : "/images/my_image.png";
}

or use it with an imageview:

myImageView.image = "/images/my_image.png";

Hope this helps.

Upvotes: 1

Related Questions