android - How to use findViewById in a function inside a fragment -


i wanna find layouts in function written in fragment nullpointerexception here code:

@override public view oncreateview(layoutinflater inflater, viewgroup container,             bundle savedinstancestate) {          v = (viewgroup)inflater.inflate(r.layout.main,null);          return v;     }  public void myfunction(string etat) {          linearlayout mylayout3 = (linearlayout) v.findviewbyid(                     r.id.f_2); 

in fragment can retrieve views getview().findviewbyid(int viewid)


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -