public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment View rootView = inflater.Inflate(Resource.Layout.fragment_project, container, false); mProject = new project(); mRecyclerView = rootView.FindViewById <RecyclerView>(Resource.Id.rvProject); mLayoutManager = new LinearLayoutManager(rootView.Context); mRecyclerView.SetLayoutManager(mLayoutManager); projectList = (Activity as MainActivity).getList(); for (int i = 0; i < projectList.D.Results.Length; i++) { mProject.addProject( projectList.D.Results[i].Title, projectList.D.Results[i].Start, projectList.D.Results[i].Finish, projectList.D.Results[i].percentComplete, projectList.D.Results[i].Work, projectList.D.Results[i].Duration); } mProjectAdapter = new ProjectAdaper(mProject, (Activity as MainActivity)); mProjectAdapter.itemClick += MAdapter_ItemClick; mRecyclerView.SetAdapter(mProjectAdapter); return(rootView); }
public void addProject(string projectName, string start, string end, string percent, string work, string duration) { mProject.addProject(projectName, start, end, percent, work, duration); mProjectAdapter.NotifyDataSetChanged(); }