How To: Get current layout object on Android
(by PeEll)2009.06.14Android development is a little unclear if you need to get access to an object representing a layout loaded from a .xml layout file. The way to accomplish this is to use a LayoutInflater. The purpose of this class is to instantiate an object capable of openening the .xml file via its reference integer and returning a reference to the in-memory Layout object.
Example
LayoutInflater inflater = getLayoutInflater();
LinearLayout l = (LinearLayout) inflater.inflate(R.layout.main,null);
LinearLayout l = (LinearLayout) inflater.inflate(R.layout.main,null);
comments | permalink
© 2003-2010 MortalPowers, Inc.