Re: [android-developers] OnItemClick not detected in listview inside customdialog

2012-05-15 Thread VenkateswaraReddy

Send u r CODE

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] OnItemClick not detected in listview inside customdialog

2012-05-11 Thread Jason Teagle
here it is..This is the adapter class and in it there is a click on 
holder.productName where

i am displaying the dialog..


There are a couple of questions you didn't answer:

1) How do you know it isn't getting to the click handler? Are you seeing the 
dialog appear, but not get dismissed? Are you not seeing "list ID CLICKED" 
in LogCat? I assume you *are* seeing the dialog appear? You have one click 
handler being added inside another click handler, but if you're seeing the 
dialog appear then it must at least be getting inside the outer handler.


2) Do you see any unusual entries in LogCat - particularly exceptions?

Curiously, if I add a button to a content view and on clicking that, have 
this code:


@Override
public void onClick(View v)
{
   final Dialog dialog = new Dialog(m_thisScreen);
   dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
   ListView lv = new ListView(m_thisScreen); // Instead of from a resource.
   dialog.setContentView(lv);
   dialog.setCancelable(true);
   final ListView customerList = lv ; // Though final might be the issue, 
but it's not.

   customerList.setOnItemClickListener(new OnItemClickListener()
   {
   @Override
   public void onItemClick(AdapterView arg0, View arg1, int arg2, 
long arg3)

   {
   System.out.println("list ID CLICKED ");
   dialog.dismiss();

   }

   } );
   customerList.setAdapter(new ArrayAdapter(m_thisScreen, 
R.layout.list_item_layout,

   new String[] {"Hello","Goodbye"} ) );
   dialog.show();

}


it worked just fine :(


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] OnItemClick not detected in listview inside customdialog

2012-05-11 Thread vani reddy
here it is..This is the adapter class and in it there is a click on
holder.productName where i am displaying the dialog..


public class SelectedItemsAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private List arlItems;
int totalQty;
float totalPrice;
Activity activity;
private final int[] bgColors = new int[] { R.drawable.row1_bg,
R.drawable.row2_bg };

public SelectedItemsAdapter(Activity a,
List arlSelectedItems) {
this.arlItems = arlSelectedItems;
activity = a;
mInflater = LayoutInflater.from(activity.getApplicationContext());
for (PurchaseOrderItem sellItem : arlItems) {
totalQty = totalQty + sellItem.getUserQty();
totalPrice = totalPrice + sellItem.getUnitListPriceValue();
}
}


@Override
public int getCount() {
int count = 0;
if (arlItems == null)
count = 0;
else
count = arlItems.size();
return count;
}

@Override
public Object getItem(int position) {
return position;
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(final int position, View convertView,
ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.order_row_right, null);
holder = new ViewHolder();
holder.check = (CheckBox) convertView
.findViewById(R.id.check_box);
holder.productName = (TextView) convertView
.findViewById(R.id.name);
holder.quantity = (TextView) convertView
.findViewById(R.id.brand);
holder.category = (TextView) convertView
.findViewById(R.id.category);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}

final View convertViewL = convertView;

holder.check.setVisibility(View.VISIBLE);
holder.productName.setText(arlItems.get(position).getName());
 holder.category.setText(arlItems.get(position).getSupplierName());

holder.check.setTag(position);

int colorPosition = position % bgColors.length;
convertView.setBackgroundResource(bgColors[colorPosition]);
// final View convertViewL = convertView;
 holder.productName.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {


final Dialog dialog = new Dialog(activity);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.select_customer_dialog);
dialog.setCancelable(true);
Button cancel = (Button) dialog.findViewById(R.id.cancel);
ImageView close = (ImageView) dialog
.findViewById(R.id.close);
TextView detail = (TextView) dialog
.findViewById(R.id.detail);
detail.setText("Suppliers Offering "
+ arlSelectedItems.get(position).getOrderItem()
.getProduct().getName());
final ListView customerList = (ListView) dialog
.findViewById(R.id.customerList);
customerList
.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView arg0,
View arg1, int arg2, long arg3) {

System.out.println("list ID CLICKED ");
dialog.dismiss();
}
});
customerList.setAdapter(new CustomerDialogAdapter(activity,
productRoleList, productPriceList));

 dialog.show();

}
});
 return convertViewL;
}

class ViewHolder {
CheckBox check;
TextView productName, quantity, category;
}

}


>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to 
> android-developers@**googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+**unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/**group/android-developers?hl=en




-- 
Regards,
Vani Reddy

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] OnItemClick not detected in listview inside customdialog

2012-05-11 Thread Jason Teagle
In my custom dialog i have a Listview , on which i am invoking 
OnItemClickListener()

but it is not detecting..
What can be the problem


Showing us the code would help... the part where you add the listener and 
how you get a reference to the list view you add it to, and the listener's 
onClick() method.


Also, please indicate how you know it isn't triggering (often people assume 
that if they don't see some activity appear, the click isn't being 
detected - but it could be the click is detected just fine, it's just that 
the activity has a fault and isn't showing).


Does your LogCat show any unusual entries - exceptions, for example?


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] OnItemClick not detected in listview inside customdialog

2012-05-11 Thread vani reddy
Hi friends,,

In my custom dialog i have a Listview , on which i am invoking
OnItemClickListener() but it is not detecting..
What can be the problem

-- 
Regards,
Vani Reddy

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en