java - Getting error message (E/ViewRootImpl﹕ sendUserActionEvent() mView == null ) when trying to add an object to a static List -
i'm new in coding. want add myobjectchild static list declared in class of myobjectchild. error when trying add static list, works fine add same object list declared in method. don't know what's wrong. want add object static list. created list in method test if problem object or adding static list , seems problem when adding static list. can me?? here code:
public class myobjectchild extends myobject { int id; string name; static list <myobject> staticlist = new arraylist<>(); static string jsonstaticlist = null; @override public void addtolist () { list<myobject> list = new arraylist<>(); try { list.add(this); // works when running app } catch (exception e){ log.e("error", "didn’t add myobject methodlist "); } try { staticlist.add(this); // doesn't work when running app } catch (exception e){ e.printstacktrace(); } //got message: e/viewrootimpl﹕ senduseractionevent() mview == null }
Comments
Post a Comment