Problem in Creating a View Dynamically ( in Android ) [Error : couldn't save which view ...] -


i'm trying create view dynamically (on click). person have idea why not work. opens blank (black) screen. when click moves previous screen well. , need know way i'm trying set team correct.

public class details extends activity {      protected void oncreate(bundle savedinstancestate){         super.oncreate(savedinstancestate);         //settheme(android.r.style.theme_dialog);          textview label = new textview(this);           label.settext("hello text");           label.setlayoutparams(new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content));         label.settextsize(20);                 label.setgravity(gravity.center);          tablerow tr = new tablerow(this);         tr.addview(label);          tablelayout tl = new tablelayout(this);         tl.setlayoutparams(new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content));         tl.setgravity(gravity.center);         tl.addview(tr);          scrollview sv = new scrollview(this);         sv.setlayoutparams(new layoutparams(layoutparams.fill_parent, layoutparams.fill_parent));         sv.addview(tl);          setcontentview(sv);     }        } 

there msg in logcat following

couldn't save view has focus because focused view ##### has no id  

well 1 obvious thing using generic layoutparams, not correct parameters layout manager. example not using tablelayout.layoutparams textview not telling how layout text view within table structure.

i suggest using hierarchyviewer @ going on view hierarchy.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -