When authoring a control, it's common to include code that must run outside the editor, otherwise it would cause an exception in edit mode.
The following code shows how to do it:
public class YourControl extends FrameLayout {
public YourControl (Context context, AttributeSet attrs) {
super(context, attrs);
if (!isInEditMode()) {
//code to run outside the editor
}
}
No comments:
Post a Comment