I'm making an application that has a lot of videos and images and I'm using them randomly in the same activity, so how can I check if the "resource id" I'm using from the database is a video or image so I can deal with each one separately?
CodePudding user response:
Put the type in the db as well, as its own field. Then you're good.
I really wouldn't suggest using resource ids in the db though. Resource ids aren't stable- the same resource may have different ids in different builds. This means when you update your app, all those ids may be broken. If you need to reference resources in an external file like a db, I'd suggest using the name and doing a name lookup- that will work unless you rename the file.