I have a pretty complex layout defined in xml
file , now I want to add this layout as a view using addView
or something else.
As layout is pret
Use
LayoutInflater factory = LayoutInflater.from(this);
View myView = factory.inflate(R.layout.my_layout_id, null);
then use addView(myView)
If your view is a ViewGroup (layout)
You can use InflaterService.inflate(id, ViewGroup)
and set the ViewGroup, it will set the current child(s) with the content of your xml.
U can also reduce this to oneline code;
View view = View.inflate(getActivity, R.layout.my_layout,null);
then add to your view.