Android: Dynamically add View at the runtime

Here is the coding to add a view such a as a button, layout etc. at the runtime.


LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ViewGroup parent = (ViewGroup)findViewById(R.id.where_you_want_to_insert);
inflater.inflate(R.layout.the_child_view, parent);

Comments

Popular posts from this blog

Fatal: LoadModule: error loading module 'mod_sql_mysql.c'

How to hide Android Soft Keyboard