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
assert obj != null : \"object cannot be null\"
Create your own assert method:
public static T assertNotNull(T object) { if (object == null) throw new AssertionError("Object cannot be null"); return object; }
Returning same object allows for using this in assignments for brevity.