android - PutLong on a null Long in argument Bundle -
given new instance method of fragment:
public static myfragment newinstance(long somelong) { bundle args = new bundle(); myfragment fragment = new workoutdetailsroutineinfofragment(); args.putlong(args_long, somelong); fragment.setarguments(args); return fragment; }
if somelong
null, doesn't work.
caused by: java.lang.nullpointerexception: attempt invoke virtual method 'long java.lang.long.longvalue()' on null object reference
how store long if it's null?
check if null , if null add -1 if not null add long object. pretty easy
Comments
Post a Comment