Zompies 20 Posted October 26, 2015 Can someone please explain how to use widgets because i'm having trouble with this. I have WidgetChild cookInterface = getWidgets().getWidgetChild(317, 2); Something along those lines and i have in if statement. if(cookInterface.isVisible){cookInterface.interact("Cook all");} But I get a null pointer exception. I am not sure how to detect if the widget is on the screen can someone please help?
DefCon 121 Posted October 26, 2015 The problem is most likely that you're trying to check if the widget is visible before it is open.. thus making cookInterface null.
Zompies 20 Author Posted October 27, 2015 The problem is most likely that you're trying to check if the widget is visible before it is open.. thus making cookInterface null. i have and != null but still its messing up
Ales 2 Posted October 27, 2015 You should have two widgets to avoid null exception. Just my thoughts..
Dreamlicker 750 Posted October 27, 2015 Can someone please explain how to use widgets because i'm having trouble with this. I have WidgetChild cookInterface = getWidgets().getWidgetChild(317, 2); Something along those lines and i have in if statement. if(cookInterface.isVisible){cookInterface.interact("Cook all");} But I get a null pointer exception. I am not sure how to detect if the widget is on the screen can someone please help? if (cookInterface != null && cookInterface.isVisible())
DefCon 121 Posted October 27, 2015 try checking that the parent node isnt null first?.... if(getWidgets().get(317)!=null) WidgetChild cookInterface = getWidgets().getWidgetChild(317, 2);
fomfomfom 0 Posted February 13, 2016 Can someone please explain how to use widgets because i'm having trouble with this. I have WidgetChild cookInterface = getWidgets().getWidgetChild(317, 2); Something along those lines and i have in if statement. if(cookInterface.isVisible){cookInterface.interact("Cook all");} But I get a null pointer exception. I am not sure how to detect if the widget is on the screen can someone please help? How did you find the 317 and 2 numbers? I am having a horrible time figuring out how to work with widgets. (I actually want to check for the cooking interface, as well).
Pandemic 2853 Posted February 13, 2016 How did you find the 317 and 2 numbers? I am having a horrible time figuring out how to work with widgets. (I actually want to check for the cooking interface, as well). Use our widget hover debugger (Tools -> Debug -> Widget Hover or something like that)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.