I have a question there is some way to get the name of a file (in my case an image) from your URI obtained I have the sgt code: and I would like to know if there is any way to get the specific name of the file thanks.
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (resultCode != RESULT_OK) {
return;
}
if (resultCode == -1 && requestCode == PickImageActivity.PICKER_REQUEST_CODE) {
this.listaRuta = intent.getExtras().getStringArrayList(PickImageActivity.KEY_DATA_RESULT);
if (this.listaRuta != null && !this.listaRuta.isEmpty()) {
StringBuilder sb=new StringBuilder("");
listaImagenes.clear();
for(int i = 0; i< listaRuta.size(); i++) {
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), Uri.fromFile(new File(listaRuta.get(i))));
} catch (IOException e) {
e.printStackTrace();
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
String encodedImage = Base64.encodeToString(byteArrayOutputStream.toByteArray(), Base64.DEFAULT);
listaImagenes.add(encodedImage);
sb.append("Foto"+(i+1)+":"+ listaRuta.get(i));
sb.append("\n");
}
}
}
}