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(;
inflater.inflate(R.layout.the_child_view, parent);


Popular posts from this blog

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

Regular Expression Route Constraints And Route Names in Laravel 5.4