somerandomusername
somerandomusername

Reputation: 2023

Android onActivityResult returns different code

I'm using starting my Intent with code 291 and result always comes in with status OK and code 131363. I don't have such nr. anywhere in my code. What could be causes for this?

If I start with code 294 it gives result 131366

@SuppressLint("NewApi")
protected void startActivity(Intent intent) {
    CL.v("start for result " + type);
    if (activity != null) {
        activity.startActivityForResult(intent, type);
    } else if (fragment != null) {
        fragment.startActivityForResult(intent, type);
    } else if (appFragment != null) {
        appFragment.startActivityForResult(intent, type);
    }
}

Upvotes: 0

Views: 211

Answers (1)

erakitin
erakitin

Reputation: 11517

If you call startActivityForResult from the Fragment the result will deliver to the Fragment. And if you call startActivityForResult from the Activity the result will deliver to the Activity.

If you want to get the result in your Fragment try to change: activity.startActivityForResult(intent, type); to startActivityForResult(intent, type);

And remove all if statements.

Upvotes: 1

Related Questions