This lines causes trouble I guess:
View View = inflater.inflate(R.layout.fragment_main, container, false);
ListView list = (ListView) getView().findViewById(R.id.listView1);
Don't use the getView()
method to find Views by Id. Use the inflated layout instead:
View root = inflater.inflate(R.layout.fragment_main, container, false);
ListView list = (ListView) root.findViewById(R.id.listView1);
The reason for this is getView() only returns the Fragments View if onCreateView
has returned.