java - How to get the value of a String from other class to a class in Android? -
my code goes this, created constructor. , want access string homepage.java login.php. android gives me error "access constructor not allowed".. doing wrong? pls help. homepage.java
public class homepage extends activity { private button clbtn; private button bcbtn; private button atbtn; public string ip=""; homepage() { this.ip = "http://111.111.11.1/sp/"; } public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.home_page); } }
login.java
public class login extends activity { private edittext etfacno; private edittext etpassword; private button loginbtn; homepage getip = new homepage(); string url = getip.ip; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.login_page); . . . . . httpclient httpclient = new defaulthttpclient(); httppost request = new httppost(url+"loginteacher.php"); } }
http://docs.oracle.com/javase/tutorial/java/javaoo/accesscontrol.html
you've declared constructor homepage
no modifier. means classes in same bundle can phone call why you're getting error.
homepage() { ...
make public
public homepage() { ...
java android constructor
No comments:
Post a Comment