unknown os platform
Android Convert URI to string and string to URI programmatically | Whats-online.info
whats-online-info

Android Convert URI to string and string to URI programmatically


Android
2017/01/21 / Science and Tutorials

Android code: Learn how to convert an image URI to string and vice versa programmatically.





Convert image Uri to string and string to image Uri in Android





Hi, hope you are faring fine, and also I'm fairing fine. For this post, I would like to show how to convert an image URI to string and vice versa in Android programmatically.

We can define an image Uri as the path where the image is located as shown below. 

Uri imageUri="content://media/external/images/media/717";

example
let us say, you have an image on your external storage, and you would like to intent to another class, the image URI example is shown below.
 
Android code: Convert URI to string 

  String imageString=imageUri.toString();

Android code: convert string  to URI 

  Uri imageConvertToUri = Uri.parse(imageString);

 Thanks for your time. Subscribe to our newsletter to get the latest updates direct to your mailbox.












You may also like:


Leave a comment












Subscribe to get replies direct to your mailbox

Submit comment