You can try
ContentResolver cR = context.getContentResolver();
MimeTypeMap mime = MimeTypeMap.getSingleton();
String type = mime.getExtensionFromMimeType(cR.getType(uri));
Edit :
mime.getExtensionFromMimeType(cR.getType(uri))
returns -> "jpeg"
cR.getType(uri);
returns "image/jpeg" that is the expected value.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…