Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Create your animation and call it in your list <code>OnItemClickListener</code>. After that you might use the adapter's <code>notifyDataSetChanged</code> to refresh the list content.</p> <p>In this example, I created a method called <code>removeListItem</code> with receives the row you want to remove and the position of that row in you list content array.</p> <pre><code>public class MainActivity extends ListActivity implements OnItemClickListener{ ArrayList&lt;String&gt; values; ArrayAdapter&lt;String&gt; adapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); values = generateMockData(50); adapter = new ArrayAdapter&lt;String&gt;( this, android.R.layout.simple_list_item_1, values); setContentView(R.layout.activity_main); getListView().setAdapter(adapter); getListView().setOnItemClickListener(this); } private ArrayList&lt;String&gt; generateMockData(int number) { ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(); for(int i = 0; i &lt; number; i++) result.add(""+i+" "+ (int)Math.random() * 13); return result; } private void removeListItem(View rowView, final int positon) { Animation anim = AnimationUtils.loadAnimation(this, android.R.anim.slide_out_right); anim.setDuration(500); rowView.startAnimation(anim); new Handler().postDelayed(new Runnable() { public void run() { values.remove(positon);//remove the current content from the array adapter.notifyDataSetChanged();//refresh you list } }, anim.getDuration()); } public void onItemClick(AdapterView&lt;?&gt; arg0, View row, int position, long arg3) { if(position == YOUR_INDEX) //apply your conditions here! removeListItem(row,position); } </code></pre>
    singulars
    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.
    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