Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone,
Im trying to create a UI for a fragment in an app. When i use onCreateView i have to use a layout file. How do i create a layout from code and use that.
I need to do this because my the content for the layout is from the server

This is what i have in my fragment class

Java
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                Bundle savedInstanceState) {
           // Inflate the layout for this fragment


       return inflater.inflate(R.layout.fragment_storelist, container, false);
}


This is what i want to do

Java
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                Bundle savedInstanceState) {
           // Inflate the layout for this fragment


       return inflater.inflate(getLayoutFunction(), container, false);
}


I just want to fill the layout in code. Thats all
Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900