Stack Overflow archive
0 score

Android - Getting Img Uri from file in drawable

score
0
question views
1K
license
CC BY-SA 3.0

You need to change your Uri. R.drawable.img is a resource id.

Example:

java
Uri uri = Uri.parse("android.resource://your.package.here/drawable/img");

Change "your.package.here" with the package-name of your application.


EDIT

I don't have experience with the FacebookSdk. However, a quick Google search shows code snippets and problems that relate to your question. For example, this code snippet call's setMetaData. Example:

java
ShareToMessengerParams shareToMessengerParams = ShareToMessengerParams.newBuilder(uri,"image/jpeg").setMetaData("{ \"image\" : \"img\" }").build();

Some more related links:

Facebook Messenger sending metadata (Android)

Get the URI of an image stored in drawable

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.