java - Pass variable between non-activity class to android activity class -
i need pass variable (around)non-activity class nameget(android activity)class . display passed variable value in text view.. please tel me needs example. how pass android activity
public class around(non-activity class) { string name = "arjun"; //how pass name value below activity nameget nam = new nameget(); string new = nam.get(name); } public class nameget extends activity(android activity class) { public string get(string name) { string got = name; textview t1 = (textview)findviewbyid(r.id.textview1); t1.settext(name); } }
try this, declare non activity class in activity class.
public class around(non-activity class) { public static string name; name = "arjun"; //how pass name string below activity } public class nameget extends activity(android activity class) { around ar = new around(); //declare non activity class here public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); textview t1 = (textview)findviewbyid(r.id.textview1); t1.settext(ar.name); } }
java android android-activity textview
No comments:
Post a Comment