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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -