Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //как надо:
- Intent photoPickerIntent = new Intent();
- photoPickerIntent.setType("*/*");
- getActivity().startActivityForResult(photoPickerIntent, PICK_IMAGE);
- //---------
- //что было у них:
- Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
- //pickIntent.setType("image/*");
- pickIntent.setType("*/*");
- Intent intent = new Intent(Intent.ACTION_PICK);
- intent.setPackage("com.omichsoft.gallery");
- intent.setType("*/*");
- PackageManager pm = getActivity().getPackageManager();
- List<ResolveInfo> apps = pm.queryIntentActivities(intent, 0);
- if (apps == null || apps.size() == 0) {
- Intent marketIntent = new Intent(Intent.ACTION_VIEW);
- marketIntent.setData(Uri.parse("market://details?id=com.omichsoft.gallery"));
- marketIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- try {
- startActivity(marketIntent);
- } catch (android.content.ActivityNotFoundException e) {
- e.printStackTrace();
- Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=com.omichsoft.gallery"));
- browserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(browserIntent);
- }
- } else {
- getActivity().startActivityForResult(intent, PICK_IMAGE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement