You get this exception only in android.support.v4.app.FragmentActivity
and not when you use android.app.Activity
.
startActivityForResult()
in FragmentActivity
requires the requestCode
to be of 16 bits, meaning the range is from 0 to 65535.
Also, validateRequestPermissionsRequestCode
in FragmentActivity
requires requestCode
to be of 16 bits, meaning the range is from 0 to 65535.
For more info(if you want to see the source code) : https://stackoverflow.com/a/33331459/4747587