Saturday, 5 September 2020

I am looking for ExpandableListView Auto Scroll to particular position

I want my app to auto-scroll at particularGroup in ExpandableList when a user selects a particular group name from RecyclerView. I am using the Interface to handle the click from RecyclerView

here is my mainActivity code:

 @Override
public void onItemClick(int position) {
    menuListForRestaurant.setVisibility(View.GONE);
    if (!menuOpenChecker){
        menuOpenChecker=true;
    }else{
        menuOpenChecker=false;
    }
    //The above code gets execute except for the below one
   listView.smoothScrollToPosition(position);// this line is not executing
}

@SuppressLint("ClickableViewAccessibility")
private void ListViewAdapter(final HashMap<String, ArrayList<ProductList>> objectMap, final ArrayList<String> headerList) {

    listViewAdapter= new RestaurantItemListView(RestaurantDetail.this.getApplicationContext(), objectMap,headerList);
    listView.setAdapter(listViewAdapter);
    listViewAdapter.notifyDataSetChanged();
}

private void RecyclerMenuView(ArrayList<String> headerList){
    menuItemRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    menuItemRecyclerView.getRecycledViewPool().clear();
    menuAdapterRecyclerView= new RestaurantMenuRecyclerView(headerList, this.getApplicationContext());
    menuItemRecyclerView.setItemAnimator(new DefaultItemAnimator());
    menuItemRecyclerView.setAdapter(menuAdapterRecyclerView);
    menuAdapterRecyclerView.notifyDataSetChanged();
    menuAdapterRecyclerView.setOnClick(RestaurantDetail.this);

}

Its like the line which I have mentioned as not working because it doesn't get updated at the ExpandableListView

Thank you in Advance please anyone??



from I am looking for ExpandableListView Auto Scroll to particular position

No comments:

Post a Comment