When you insert a new item into a database like this
Uri uri = getContentResolver().insert(Tournaments.CONTENT_URI, values);
is there any way to get the id from the uri that is returned so I don't have to run a query to get the id since its already in the returned uri?
ContentUris.parseId() converts the last path segment to a long.
long id = Long.valueOf(uri.getLastPathSegment());
Use ContentUris.parseId(uri) This statement will Converts the last path segment to a long.
Read Documentation in here
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