How to use assert in android?

后端 未结 6 2209
日久生厌
日久生厌 2020-12-08 09:35

I want to use assert obj != null : \"object cannot be null\" on Android device. The assert doesn\'t seem to work, so I searched online and I found this local so

6条回答
  •  一整个雨季
    2020-12-08 10:07

    if (somevar == null) throw new RuntimeException();

    Replace RuntimeException() with an appropriate exception subtype.

提交回复
热议问题