Reputation: 900
I need to do an Quiz App with pictures associated to the questions. The problem is that there should be default questions with the app and in future the app shall be able to create more questions and i dont know how to store the pictures paths on database mainly because of the default questions.
My first aproach is to have the default pictures in the res/drawables
but how can i get the path of res/drawables
pictures?
I hope to have explained my problem well.
Upvotes: 1
Views: 61
Reputation: 1314
Have a look on Android Save and Retrieve Image Path From Database
Upvotes: 1
Reputation: 93708
Res/drawables doesn't have paths. They have integer ids. So there's no path to get. Those ids also change every compile, so hardcoding them isn't always ideal.
I would suggest that the first time you start up, you write those default images to disk. This gives you two benefits- one you have a path. Two, you can treat default images and non-default images with the exact same code.
Upvotes: 1