@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_draganddrop); DynamicListView listView = (DynamicListView) findViewById(R.id.activity_draganddrop_listview); listView.setDivider(null); TextView headerView = new TextView(this); headerView.setText("HEADER"); listView.addHeaderView(headerView); final ArrayAdapter<Integer> adapter = createListAdapter(); AlphaInAnimationAdapter animAdapter = new AlphaInAnimationAdapter(adapter); animAdapter.setInitialDelayMillis(300); animAdapter.setAbsListView(listView); listView.setAdapter(animAdapter); Toast.makeText(this, "Long press an item to start dragging", Toast.LENGTH_LONG).show(); listView.setOnItemMovedListener( new DynamicListView.OnItemMovedListener() { @Override public void onItemMoved(final int newPosition) { Toast.makeText( getApplicationContext(), adapter.getItem(newPosition) + " moved to position " + newPosition, Toast.LENGTH_SHORT) .show(); } }); }
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); mExpandableListItemAdapter = new MyExpandableListItemAdapter(this, getItems()); AlphaInAnimationAdapter alphaInAnimationAdapter = new AlphaInAnimationAdapter(mExpandableListItemAdapter); alphaInAnimationAdapter.setAbsListView(getListView()); alphaInAnimationAdapter.setInitialDelayMillis(500); getListView().setAdapter(alphaInAnimationAdapter); Toast.makeText(this, R.string.explainExpand, Toast.LENGTH_LONG).show(); }