Error inflating when extending a class

I’m trying to create a custom view GhostSurfaceCameraView that extends SurfaceView. Here’s my class definition file GhostSurfaceCameraView.java: public class GhostSurfaceCameraView extends SurfaceView implements SurfaceHolder.Callback { SurfaceHolder mHolder; Camera mCamera; GhostSurfaceCameraView(Context context) { super(context); // Install a SurfaceHolder.Callback so we get notified when the // underlying surface is created and destroyed. mHolder = getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); … Read more

How do I correctly setup and teardown for my pytest class with tests?

I am using selenium for end to end testing and I can’t get how to use setup_class and teardown_class methods. I need to set up browser in setup_class method, then perform a bunch of tests defined as class methods and finally quit browser in teardown_class method. But logically it seems like a bad solution, because … Read more

Why can outer Java classes access inner class private members?

I observed that Outer classes can access inner classes private instance variables. How is this possible? Here is a sample code demonstrating the same: class ABC{ class XYZ{ private int x=10; } public static void main(String… args){ ABC.XYZ xx = new ABC().new XYZ(); System.out.println(“Hello :: “+xx.x); ///Why is this allowed?? } } Why is this … Read more

Call static methods from regular ES6 class methods

What’s the standard way to call static methods? I can think of using constructor or using the name of the class itself, I don’t like the latter since it doesn’t feel necessary. Is the former the recommended way, or is there something else? Here’s a (contrived) example: class SomeObject { constructor(n){ this.n = n; } … Read more