目录

Android Can only use lower 16 bits for requestCode

bash

java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
...
...

context.startActivityForResultrequestCode 有对应限制

对应源码为

java

@Override
public void startActivityForResult(Intent intent, int requestCode) {
    if (requestCode != -1 && (requestCode&0xffff0000) != 0) {
      throw new IllegalArgumentException("Can only use lower 16 bits for requestCode");
    }
    super.startActivityForResult(intent, requestCode);
}