public static long parseId(Uri contentUri){
  String last=contentUri.getLastPathSegment();
  return last == null ? -1 : Long.parseLong(last);
}

public static long parseId ( Uri contentUri ) { String last = contentUri . getLastPathSegment ( ) ; return last == null ? - 1 : Long . parseLong ( last ) ; }
converts the last path segment to a long . < p > this supports a common convention for content uris where an id is stored in the last segment .
