Android - java.lang.IllegalArgumentException Erron when creating Dialog on 2.1 and low android

前端 未结 5 1230
既然无缘
既然无缘 2021-01-23 04:27

I\'m getting the below error message from phones that are SDK version < 8. I just released this app on the android market and prior to release my test phones were a HTC Thun

5条回答
  •  旧时难觅i
    2021-01-23 04:29

    I believe the easiest way to deal with this pesky exception is to just catch it:

    @Override
    public void showDialog(int dialogId) {
      try {
        super.showDialog(dialogId);
      } catch (IllegalArgumentException e) { /* Log it if you wish*/ }
    } 
    

    That said, I don't think you're using onCreateDialog() as the API intended (which is why you were seeing the strange behavior), it should definitely return a dialog object most of the time.

提交回复
热议问题