[android-developers] access to the edittexts inside adapter

2010-04-19 Thread FrankieCZ
Hi,

I'm facing following problem. I have a layout, which is inflated
inside an adapter (extended BaseAdapter). The layout consists of
TextView, EditText and of two buttons (Save and Delete). This group is
for each item in database and then it's listed one by one, so it
means, on screen there can be several groups of these widgets.

The point is, how to access the content of the EditText in the group
when I press the button Save? I've tried to put setTag() on EditText
and Save button:

...
public View getView(...) {
...
contentEditText = (EditText) v.findViewById(R.id.ContentEditText);
contentEditText.setTag(EditText + mIds.get(position));

editBtn.setTag(mIds.get(position));
editBtn.setOnClickListener(editBtnListener);
}

and then in the listener to access the EditText via findViewWithTag:

private OnClickListener editBtnListener = new OnClickListener() {
public void onClick(final View v) {
logger.LogInfo(EDIT_BTN onClickListener():  + v.getTag());
EditText tmp = (EditText)
v.findViewWithTag(EditText+v.getTag());
}
};

The first line
logger.LogInfo(EDIT_BTN onClickListener():  + v.getTag());
return the correct Tag for the pressed button (first, second row,
etc.)

Unfortunately,
the second line where I'm trying to get the EditText object, the tmp
object is null, so, the object is not found with the findViewWithTag
method...


Any idea how to solve this or maybe to use another approach in this
situation?

Thanks
Frankie

-- 
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] Re: Multiple choice in alert dialog

2010-03-15 Thread FrankieCZ
After googling, I found the same problem reported here:

http://code.google.com/p/android/issues/detail?id=2998

Unfortunately, even there is no response from other users or android
developers. Nobody else is facing this problem? I would expect that
multichoice option (with items loaded from the database via Cursor) is
often used in applications

Any idea how to fix it or some work-around to make it work?

-- 
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] Multiple choice in alert dialog

2010-02-22 Thread FrankieCZ
Hi,

I'm focusing following problem.

I have an alert dialog with setMultipleChoiceItems, dialog is created
and shown correctly but when I try to uncheck any of the selected
items, the item stays checked.

Here is the snippet of the code:

SimpleCursorAdapter adapter = new SimpleCursorAdapter(context,
android.R.id.text1,
c,
new String[] {label},
new int[] {android.R.id.text1}
);

AlertDialog dialog=new AlertDialog.Builder(context)
   .setTitle(title)
   .setPositiveButton(R.string.okBtn, null)
   .setNegativeButton(R.string.cancelBtn, null)
   .setMultiChoiceItems(c,state,label,
   new DialogInterface.OnMultiChoiceClickListener() {
public void onClick(DialogInterface dialog, int 
which,
boolean isChecked) {

Log.v(TEST, onClick(..) called with 
value  + which +  /
+ isChecked);

}
   })
   .create();

 dialog.show()

Althought, method OnMultiChoiceClickListener() is called and in log I
can see:
onClick(..) called with value 2 / false

so it says that chosen item is supposed to be FALSE (unchecked) but
the dialog is not updated and item stays checked.

Any ideas why it is like this?

-- 
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