androidworkz
androidworkz

Reputation: 2942

Picking image from gallery always returns resultCode -1

Here is my code.

Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 
intent.setType("image/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(
        Intent.createChooser(
                intent,
                "Select Image"),
        SELECT_IMAGE_LOCAL);

For some reason it is always returning -1. Any ideas what I am doing wrong?

Upvotes: 0

Views: 309

Answers (2)

ElYeante
ElYeante

Reputation: 1755

RESULT_OK has a value of -1:

http://developer.android.com/reference/android/app/Activity.html#RESULT_OK

Why it is that way is a good question for the android designers... perhaps an internal joke.

Upvotes: 0

tcBulldog
tcBulldog

Reputation: 51

Isn't -1 the value of RESULT_OK ?

Upvotes: 2

Related Questions