i have uri type data and i put data in intent using putExtra() but i have no idea how i get data in the uri from.
else if(requestCode==2){
if (data != null) {
Uri uri = data.getData();
Intent intent = new Intent(getBaseContext(),BackUp_Main.class);
intent.putExtra("singleImage", uri);
startActivity(intent);
}
}
how can i get uri data in the from of uri??
You can parse and get Uri
like this:
// Add an Uri instance to an Intent
intent.putExtra("imageUri", uri);
Then, when you need it, just get it back this way:
// Get an Uri from an Intent
Uri uri = intent.getParcelableExtra("imageUri");
You can convert a uri to String as follows:-
intent.putExtra("singleImage", uri.toString());
and then while getting intent convert String to uri back
Uri myUri = Uri.parse(extras.getString("singleImage"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With