Skip to content Skip to sidebar Skip to footer

Cannot Retrieve Data From Mysql Using Json And Put Them In A Listview With Fragments

Source code public class VendingFragment extends ListFragment { private String Tag = 'VendingFragment'; private static final String TAG_SUCCESS = 'success'; private ListView list

Solution 1:

onCreateView must only return the view that represent the fragment. Other operations on the View should be performed in another callback, your code must be like following:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

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

 @Override 
 public void onViewCreated (View view, Bundle savedInstanceState) {

    vendinglist = new ArrayList<HashMap<String, String>>();
    listView = (ListView) view.findViewById(R.id.allVendingListView);

    listView = getListView();
    new get_all_vendingmachine().execute();
}

Post a Comment for "Cannot Retrieve Data From Mysql Using Json And Put Them In A Listview With Fragments"