How to pass the class name reference to edit text which is inside static method in android -
i have static method , inside method creating edit text dynamically.
here code, public static void done() { edittext[] edittext = new edittext[dynamiclen]; (int n = 0; n < dynamiclen; n++) { edittext[n] = new edittext(clasname.this); ...... }
when use code, getting error in classname.this saying can't reference. tried changing clasname.class.getname().this still not able resolve it. great
new edittext()
requires context
not class name
so can modify method below
public static void done(context context) { edittext[] edittext = new edittext[dynamiclen]; (int n = 0; n < dynamiclen; n++) { edittext[n] = new edittext(context); ...... }
Comments
Post a Comment