brucetoo / PickView

Date and Province WheelView like IOS
1.1k stars 265 forks source link

LoopView - Does not work with dynamic values from server #56

Open codebreaker9904 opened 6 years ago

codebreaker9904 commented 6 years ago

LoopView is not refreshing itself: 1) Never shows rows in loopview, when i pass a arraylist from server, after fetching it. 2) Once i put app in background and bring it back, it shows the rows.

P.S: I tried invalidate() , postinvalidate() , recreate() . Nothing works.

Below is my code:

public void refreshcategoryloop(){
    categoryLoop = (LoopView)findViewById(R.id.categoryLoop);
    categoryView.setVisibility(View.VISIBLE);
    categoryLoop.setInitPosition(0);
    categoryLoop.setCanLoop(false);
    categoryLoop.setLoopListener(new LoopScrollListener() {
        @Override
        public void onItemSelect(int item) {

        }
    });
    categoryLoop.setTextSize(15);
    categories = new ArrayList<String>();

    for (int l = 0; l < servicesArr.length(); l++) {
        try {
            categories.add(servicesArr.getJSONObject(l).getString("Performance").toString());
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    categoryLoop.setDataList(categories);

}

And find attached the screenshots. 3e1cc379-a2e8-4862-88b3-4d6b0ec5c7ac d087a820-29c0-43d5-8e17-5976e204ff4d