android - How would i store a number/string into R.string.xx? -
android - How would i store a number/string into R.string.xx? -
with code, programme forcefulness close(error)
***public view x = findviewbyid(r.string.nfoname);*** @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.information); //edittext ***final edittext infoname=(edittext)findviewbyid(r.id.infoname);*** //clear,confirm button clear = (button)findviewbyid(r.id.buttonclear); button confirm = (button)findviewbyid(r.id.buttonconfirm); //clear button clear.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { // todo auto-generated method stub infoname.settext(""); } }); //confirm button confirm.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { ***x=(view) infoname.gettext();*** } }); }
the 1 * source of error
program function: if user clicks confirm, name set r.string.nfoname used in layout through textview x = settext(r.string.nfoname);
i not sure can save text r.string. generated class compiler creates you. gets packaged apk. think of resources means of translation , nowadays text screen.
i think want save user input sharedpreference or in database.
see:sharedpreferences on android docs illustration usage.
android string settext
Comments
Post a Comment