android - Handle textview state when fragment orientation changes -
i have in fragment layout textview default visibility state = "gone"; in fragment class add information textview , show it. fragment have setretaininstance = true cursorloader saving. when orientation changes textview hide. think because:
public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view = inflater.inflate(r.layout.fragment, null); tvnowusedfiltres = (textview) view.findviewbyid(r.id.tvtextview);
it's changes state "gone". cant save instance state, because bundle returns null setretaininstance = true. how can save text view state?
the setretaininstance() not work widgets, because widgets wired activity (not fragment).
so, need put member boolean value in fragment class, , in oncreateview(), reset visibility parameter of textview after getting it:
tvnowusedfiltres = (textview) view.findviewbyid(r.id.tvtextview); if (mynewboolean) { tvnowusedfiltres.setvisibility(view.visible); }
Comments
Post a Comment