I have a dynamic gridview that is showing views as expected. But now i want to set shake animation to each view on button click.
For example when i click the edit button, each view shakes and then i can delete that view from grid.
Here is my adapter:
public class ImageAdapter extends BaseAdapter
{
private Context mContext;
private final List<Struct_Wallet_Name> wallets;
public ImageAdapter(Context c, List<Struct_Wallet_Name> wallets)
{
this.mContext = c;
this.wallets = wallets;
}
public int getCount()
{
return wallets.size();
}
public Object getItem(int position)
{
return null;
}
public long getItemId(int position)
{
return 0;
}
// create a new ImageView for each item referenced by the Adapter
public View getView(final int position, View convertView, ViewGroup parent)
{
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View gridView;
if(convertView == null)
{
gridView = new View(mContext);
gridView = inflater.inflate(R.layout.wallet_icons, null);
gridView.setPadding(8, 8, 8, 8);
final Animation animBounce = AnimationUtils.loadAnimation(mContext, R.anim.bounce);
gridView.startAnimation(animBounce);
TextView textView = (TextView) gridView.findViewById(R.id.id_tv_wallet);
textView.setText(String.valueOf(wallets.get(position).str_WalletName));
}
else
{
gridView = (View) convertView;
}
return gridView;
}
}
Any idea how to do this?