stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
11/01/15 05:25 PM (8 years ago)

Where do images in Android Studio go

IN the past when I compiled my Android project, I dragged my png files, which are reference by HTML files in the project, to the res/drawable section. Now I've taken an old Android project and recompiled it and now I see I have to use Android Studio. I've done that, dragged my HTML files to Bt_Docs and they open fine. But my png files, which I've dragged to the res/drawable folder just show up as placeholders. has something changed with Android Studio or is it the problem that the app was written a year ago under an older version of BT and I have to now rewrite it from scratch and then compile? Thanks. Steve
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
11/01/15 05:30 PM (8 years ago)
Well, i copied the pngs into the BT_Docs file and it now works so I guess they have to go there. My question is, can I delete them from the drawable folder or do they have to be in both places?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/01/15 06:40 PM (8 years ago)
Well, look at it logically. An HTML file, although 'displayed' in Android/Java, is not 'android/java code'. So if your HTML file has images referenced, they need to reside *in the place from where they are referenced*. So, if your HTML has code that says <img src="./boogie.png"> then you need to have the image in the same directory as the HTML file. However, a JAVA resource, called from your Java Code, will need to reside where Java expects it to be; res/drawable (or similar drawable directory for the appropriate resolution). Cheers! -- Smug
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
11/01/15 07:53 PM (8 years ago)
Makes sense, thanks. Steve
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.