java - What is isInEditMode() and if(isInEditMode()) return; -
private void init() { if (isineditmode()) return; paint.setstyle(paint.style.fill); paint.setcolor(getresources().getcolor(r.color.control_highlight_color)); paint.setantialias(true); setwillnotdraw(true); setdrawingcacheenabled(true); setclickable(true); }
i ran above code while trying understand how ripple effect created.
1) question isineditmode()
. have taken @ developer site , explanation little confusing me.
2) 1 if(isineditmode()) return;
code strikes me odd. thought if statements check follow format if(){return;}.
however, way code above formatted makes me confuse , know why so.
3) plus, if return value nothing why not not specifies in first place?
as have no answers #2 , #3, there is:
if have single instruction in if
, can omit curly braces. plus java doesn't work indentation braces , semi-colons. can put single instruction on same line if
, won't make differences, long there semi-colon.
for return;
, method returns void
, can't put object return. allows exit method, i.e. when have bad/unexpected value, return
ends method moment called. return;
means same return void;
(however i'm don't know if compile).
Comments
Post a Comment