java - Use EditText value in another activity or in an enum Android -
i want make app plays sounds different amount of times between sounds don't know how it. amount of times defined user in edittext in setting activity , songs played in activity need link edittext value in other activity. here code transform content of edittext variable don't know how use in other interface :
edittext myedit = (edittext) findviewbyid(r.id.edittext1); string myeditvalue = myedit.gettext().tostring(); time = integer.parseint(myeditvalue);
it better if can tell me how transfer edittext value in enum if know how transfer between activities , not activity enum ok.
here enum code :
public enum phasetimer { waiting("appuyez", valueinedittext1), loading("attente", valueinedittext2), on_your_mark("a vos marques", valueinedittext3), ready("pret", valueinedittext4), go("partez", valueinedittext5); public string message; public int time; phasetimer(string message, int time) { this.message = message; this.temps = temps; } public string getmessage() { return message; }
}
intent = new intent(this, theotheractivityname.class); i.putextra("myeditvalue",myeditvalue ); startactivity(i);
from other activity, can string
string newstring; bundle extras = getintent().getextras(); newstring= extras.getstring("myeditvalue");
Comments
Post a Comment