This issue is with calling the method on object whose value is null.

so make sure you write a one condition (if obj!=null) before calling a method to avoid the exceptions. This is always good ...