Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Listview not updating
    primarykey
    data
    text
    <p>I have a ListView with a custom adapter, displaying information from a database. When I start the app, the data is read from the database, given to the adapter, which is then attached to the ListView. A LayoutAnimationController is run on the ListView, displaying the contents smoothly.</p> <pre><code> this._lvList = (ListView)_v.findViewById(R.id.lvList); this._lvList.setAdapter(new TableAdapter(getActivity(),R.layout.tablerow,Category.getCategories())); LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_left)); lac.setDelay(0.2f); this._lvList.setLayoutAnimation(lac); this._lvList.startLayoutAnimation(); </code></pre> <p>No problem at all.</p> <p>Now when I click on any entry of the ListView, the entries which were not clicked disappear, the clicked entry becomes the one and only entry in the list and is displayed at the top, as expected.</p> <pre><code>View v; for(int i = 0;i&lt;_lvList.getChildCount();i++) { v = this._lvList.getChildAt(i); if(v!=clickedView) { Animation animSlideOut = AnimationUtils.loadAnimation(getActivity(), i%2==0?R.anim.slide_out_left:R.anim.slide_out_right); animSlideOut.setStartOffset(i*50); // some more stuff } v.startAnimation(animSlideOut); } </code></pre> <p>This works as well, but now the problem, if I click again on that single list entry, I want the list to repopulate, displaying all items again. </p> <p>I thought I could use the code from the start (the first snippet), as it works fine when starting the app, but...this time...it doesn't. No animation happening. The reason is, there are no views to animate in my ListView (except the one from the previous step).</p> <p>Instead of creating a new Tableadapter I already tried to clear it, fill it new, called notifyDataSetChanged()... no use, as</p> <pre><code>_lvList.getChildCount(); </code></pre> <p>stills returns 1 view, while the adapter holds all 18 entries. I as well tried </p> <pre><code>requestLayout(); forceLayout(); invalidate(); invalidateViews(); </code></pre> <p>to force the ListView to generate its child views before the animation, but it's not working. So atm the ListView just appears instantly, somewhen after my call to the layout animation.</p> <p>Summary : my ListView contains no child views before the start of the layout animation, how can I force it to generate them?</p> <p>Thx in advance :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload