Skip to content

Commit

Permalink
Use ACTION_OPEN_DOCUMENT instead of ~_GET_CONTENT
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Apr 20, 2016
1 parent 9d72d0b commit f6c0674
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app/src/main/java/fr/remram/taquindroid/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,20 @@ public void onClick(DialogInterface dialog, int item)
change_image.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, REQ_PICK_IMAGE);
// http://stackoverflow.com/a/25268677/711380
if(android.os.Build.VERSION.SDK_INT >= 19)
{
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(intent, REQ_PICK_IMAGE);
}
else
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, REQ_PICK_IMAGE);
}
}
});

Expand Down

0 comments on commit f6c0674

Please sign in to comment.