java - Possible to get reference to a View without setting the ContentView of an Activity -


i want able reference relativelayout in same way as

relativelayout relative = (relativelayout)findviewbyid(r.id.relative);

but without setting contentview of activity. think may have infalter? ultimate aim , add child view of custom view object.

yes, can use layoutinflater. example:

layoutinflater inflater = (layoutinflater)getsystemservice(context.layout_inflater_service);     view mv = inflater.inflate(r.layout.yourlayout, null); 

and could...

relativelayout relative = (relativelayout)mv.findviewbyid(r.id.relative); 

Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -