Reputation: 1163
In my app, I allow the user to create new tabs. The tab creates fine, but I do not know how I would be able to add an already created layout to that new tab.
I have tried setContent(R.layout.layout_browse)
but that causes a force close, as does adding a view to the factory and returning it.
So, how can I do what I am after?
Upvotes: 0
Views: 143
Reputation: 18873
Use LayoutInflater
View view = LayoutInflater.from(getBaseContext()).inflate(R.layout.yourxmllayout,
null);
parent.addView(view );
Upvotes: 1