Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window leaked on Tablet #58

Open
exiomsphpteam opened this issue Aug 7, 2019 · 0 comments
Open

window leaked on Tablet #58

exiomsphpteam opened this issue Aug 7, 2019 · 0 comments

Comments

@exiomsphpteam
Copy link

Hey,
I am having Window leaked exception after selecting images.
Please help.

My Code is

 Intent intent1 = new Intent(getActivity(), ImagePickActivity.class);
                intent1.putExtra(IS_NEED_CAMERA, true);
                intent1.putExtra(Constant.MAX_NUMBER, 5);
                startActivityForResult(intent1, CAMERA_PERMISSION_REQUEST_CODE);``
 case CAMERA_PERMISSION_REQUEST_CODE:
                if (resultCode == RESULT_OK) {
                    if (data != null) {
                        try {
                            ArrayList<ImageFile> list = data.getParcelableArrayListExtra(Constant.RESULT_PICK_IMAGE);
                   /* imagePath.clear();
                    imagePath = data.getStringArrayListExtra(SelectorSettings.SELECTOR_RESULTS);*/

                            for (ImageFile files : list) {
                                String extension = "";
                                String uploadedFileName = files.getPath();
                                if (null != uploadedFileName) {
                                    extension = uploadedFileName.substring(uploadedFileName.lastIndexOf("."));
                                }
                                File file = new File(uploadedFileName);
                                File attachment = new File(file.getAbsolutePath());
                                if (attachment.exists()) {
                                    FileInputStream fileInputStreamReader = null;
                                    try {
                                        fileInputStreamReader = new FileInputStream(attachment.getAbsolutePath());
                                    } catch (FileNotFoundException e) {
                                        e.printStackTrace();
                                    }

                                    byte[] bytes = new byte[(int) attachment.length()];
                                    try {
                                        int read = fileInputStreamReader.read(bytes);
                                    } catch (IOException e) {
                                        e.printStackTrace();
                                    }
                                    String attachment_base64 = Base64.encodeToString(bytes, Base64.DEFAULT);

                                    attachedPhotosList.add(new AttachedFileModule(attachment_base64, file.getName(), file.getAbsolutePath(), extension));
                                }

                            }
                            if (attachedPhotosList.size() > 0) {
                                btnUploadPhoto.setVisibility(View.VISIBLE);
                                setImageAdapter();
                            }

                        } catch (NullPointerException e) {
                            e.printStackTrace();
                        }

                    }

                }
                break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant