Is there a form for which you need to add several images in order to save them in an external database?
How to implement the selection of several images correctly (maybe the image window could be like pages and these pages could be turned over)?
Is there a form for which you need to add several images in order to save them in an external database?
How to implement the selection of several images correctly (maybe the image window could be like pages and these pages could be turned over)?
You need to run an Intent about this sort:
final Intent intent = new Intent(Intent.ACTION_GETN_CONTENT); intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); intent.setType("image/*"); intent.addCategory(Intent.CATEGORY_OPENABLE); And process in onActivityResult like this:
ArrayList<String> fileUris=new ArrayList<>(); //массив для хранения URI возвращенных файлов if(intent.getData()==null) { //detecting multiple selection ClipData clipdata = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { clipdata = intent.getClipData(); for (int i=0; clipdata!=null && i < clipdata.getItemCount(); i++) fileUris.add(clipdata.getItemAt(i).getUri().toString()); } else fileUris.add(intent.getData().toString()); } else { //single selection fileUris.add(intent.getData().toString()); } Intent will launch the file selector built into the device (if there is, of course). If not, then you can use the aFileChooser project
Source: https://ru.stackoverflow.com/questions/675910/
All Articles