I am encountering a very strange problem My List is not refreshing well as the treatment go on The treatment seems to be stopping at the first 20 values then the list view keep refreshing the same values and same values Meanwhile when I am clearing the list I can see that for one row its treating well all the data but I don't have my full listview anymore
Can someone help me to figure why my listview still recycling the same view thought it's values should change
Thanks in advance for your help guys !!
public static class DummySectionFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
public static final String ARG_SECTION_NUMBER = "section_number";
public static Map<String,StockIdentification> mapStockIdentification;
ListView listStocksView; // Listview UI
List<Stock> stocks; // My data
View rootView;ArrayAdapter<Stock> adapter;
public DummySectionFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_main_dummy,
container, false);
//Stock stock = null;
stocks = new ArrayList<Stock>();
//Création d'une instance bdd Stockidentification
StockIdentificationDao stockidDao = new StockIdentificationDao(getActivity().getApplicationContext());
StockIdentificationInit stockidInit = new StockIdentificationInit();
//getting my id object identification
stockidInit.insertDAXValues(stockidDao);
List<StockIdentification> stocksIdentification = new ArrayList<StockIdentification>(40);
stocksIdentification = stockidDao.getAllStockInfoDAXIncrease();
mapStockIdentification = new HashMap<String, StockIdentification>();
listStocksView = (ListView) rootView.findViewById(R.id.listStocks);
try {
for (StockIdentification stockID : stocksIdentification) {
mapStockIdentification.put(stockID.getShortName(),stockID);
new RequestParserID().execute(stockID.getShortName());//calling asyntask to realize the treatement
}
} catch (Exception e) {
e.printStackTrace();
}
return rootView;
}
class RequestParserID extends AsyncTask<String, Void, Stock>{
private final String TAG = getClass().getSimpleName();
private final String URL = "http://MYSERVER";
// Treatment getting my construction object
@Override
protected Stock doInBackground(String... url) {
return stock = parse(doc);
}
// Clear the adapter to consider the lastest coming data stocked in List<Stock> stocks
public void onPreExecute() {
adapter = new StockArrayAdapter(getActivity(),stocks,mapStockIdentification);
adapter.clear();
}
//refreshing my listview as the tretment is proceeeding
public void onPostExecute(final Stock stock) {
super.onPostExecute(stock);
//stocks.clear();// the row update well but i loose my list
stocks.add(stock);
listStocksView.setAdapter(adapter);
adapter.notifyDataSetChanged();
}