#computer doesnt recognize RESULT_OK and getContentResolver

5 messages · Page 1 of 1 (latest)

late galleon
#

hi, im trying to create a function that selects a photo from a phone gallery.

but when i use this code

photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, 1);

protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK)
    {
        Uri chosenImageUri = data.getData();

        Bitmap mBitmap = null;
        mBitmap = Media.getBitmap(this.getContentResolver(), chosenImageUri);
        }
}``` 
the `RESULT_OK`  and `this.getContentResolver()`  terms are lit up red and the computer says he doesnt know them. what is wrong here? 
this is on a fragment
wispy ravenBOT
#

This post has been reserved for your question.

Hey @late galleon! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

wispy ravenBOT
#
Custom Tag List

ask, debug, example, format, js, try, resources, adopt, codelength, null-pointer, restart, homework, comparing-strings, index-out-of-bounds, comparison-assignment-operators, rule11, xyproblem, static, nohello, jre_jdk, learn, help, scanner, pseudocode, class-versions

#

<@&765578700724371486>

Requested by ShadowRoar#3138