1

I've a ListView where every element in the list contains a ImageView, two TextViews , and a Button.

ListView
--------------------
|||||||  [Text]
|image|  [Text]
|||||||  [button]
--------------------
|||||||  [Text]
|image|  [Text]
|||||||  [button]
--------------------
|||||||  [Text]
|image|  [Text]
|||||||  [button]
--------------------
... (and so on) ...

this is my code click button in baseadapter

changeQty.setTag(position);
            changeQty.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(final View v) {

                    // TODO Auto-generated method stub
                    int maxOrderQty = product.getMaxOrderQty();

                    final CharSequence[] items = new CharSequence[maxOrderQty];

                    for(int i=0;i<maxOrderQty;i++){
                        items[i] = i+1+"";
                    }

                    Builder builder = new Builder(context);
                    builder.setTitle("Quantity");
                    builder.setSingleChoiceItems(items, product.getQuantity()-1, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int item) {
                            RegistryProductDB db = new RegistryProductDB(context);
                            db.updateRow(
                                    RegistryProductDB.PRODUCT_TABLE,
                                    product.getUpcNumber(),
                                    product.getProductId(),
                                    product.getProductName(),
                                    product.getProductImage(),
                                    product.getColor(),
                                    product.getSize(),
                                    item+1,
                                    System.currentTimeMillis(),
                                    product.isStoreOnly(),
                                    product.getMaxOrderQty()
                                    );

                            product.setQuantity(item+1);
                            notifyDataSetChanged();
                            Toast msg = Toast.makeText(context, "item updated", Toast.LENGTH_SHORT);
                            msg.setGravity(Gravity.CENTER, 0, 0);
                            msg.show();
                            dialog.dismiss();
                        }
                    });

                    AlertDialog alert = builder.create();
                    alert.show();
                }
            });

if user click a button on row list, it will show spinner to select an options. and after click it i want to show toast in the middle row list where the button is clicked. How is that done? thanks

dagger24
  • 115
  • 1
  • 2
  • 6
  • 1
    Have a look at this answer: - [how to change position of Toast in android?](http://stackoverflow.com/questions/2506876/how-to-change-position-of-toast-in-android) – dave.c Jan 30 '12 at 20:51

0 Answers0