android - How to save the button that has been added dynamically in andriod? -
i had searched many similar questions , know how dynamic add button how can save can see when reopen app...
linearlayout.layoutparams params = new linearlayout.layoutparams( linearlayout.layoutparams.match_parent, linearlayout.layoutparams.wrap_content); button btn = new button(mainactivity.this); linearlayout linaer = (linearlayout) findviewbyid(r.id.linearlayout1); btn.setid(count); final int id_ = btn.getid(); btn.settext(edittext.gettext().tostring()); **linaer.addview(btn, params);** button btns = ((button) findviewbyid(id_)); btns.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { intent = new intent(); it.setclass(mainactivity.this, album_main.class); startactivity(it); }
when create button keep flag of , when reopen app check flag. if matches condition create button want.
Comments
Post a Comment