How to get path(String) of image in android drawable

Hello i need help, i am trying to have a default image to show if a user didn’t chose a photo while uploading. Don’t don’t know if getting the path from drawable is better idea?..

Hey Freebe,

I am hoping you are loading an Image from network and in case there is an error you want to show default image.
In this scenario if you are using glide as library then you can define the placeholder image or error image as drawable. or in case you are directly trying to get the image from network once you get the response or error then you can use ImageView.setImageDrawable(resID) like this and this will solve your problem.
If not then you can post the response here, will be able to help you.

Thanks CodeMartial, i solved the issue days ago, i had to change my logic… It might be an overkill tho.

This is what i did:
A User picks a photo from his device, the uri is converted to file and its sent to server, which works well with Multipart okhttp.

then if no image was selected,( i check for this if the uri/file path variable is empty) i use a String request function and the post is sent to server then on my server i assign a default image to the post if !isset_$_File[‘imageFile’] and its sent to database thats its.

I tried to do this on the client side but i couldn’t access the uri/path of the image from drawable.

Its solved my problem and it works fine till now. Looks like an overkill to me …but it works! And saves app size from client side.