On Wed, Sep 28, 2011 at 4:47 PM, TreKing <[email protected]> wrote:

> On Wed, Sep 28, 2011 at 9:42 AM, John Goche <[email protected]>wrote:
>
>> Wel, suppose MyType is the object being edited, in this case an EditText
>> widget.
>>
>
> No, it'd be whatever data object you've defined that your list represents.
>

OK, then suppose MyType represents a model row of data. I have no problem
updating such a model (this would be supplied to an ArrayAdapter but is not
supplied to a BaseAdapter in the constructor). I have no problem updating
the data I define. However, once the data is changed, I want the widgets
in my list to reflect the changes in the data (i.e. I want my EditText
widgets
to display the new data from the Map<MyType, List<MyType>> AKA
Map<RowModel, List<RowModel>>.


>
>
>> The adapter populates the list via getView().
>> In getView() I set the TextWatcher observer which can access the
>> Map<MyType, List<MyType>> no problem. The problem
>> is, where do I setup the Map<MyType, List<MyType>> AKA Map<EditText,
>> List<EditText>> ?
>>
>
> I would assume in the adapter that feeds your list.
>

Well, I set up my row models before I feed them into the adapter. They are
accessible from the adapter.
But row views are not it seems. Given a position, how do I access a row view
corresponding to that position?


>
>
>> If I had a static list I could do this Map initialization easily, but
>> since the list is dynamically populated via getView() I don't know how to do
>> this.
>>
>
> Generating the views is dynamic. The actual underlying data that the views
> represents probably is not.
>

Yes, the underlying data is not dynamic. But I need a handle to the row view
widgets to update them.


> Even if it is, you'd have some method that updates your map as you add /
> remove data.
>

I do have such methods. I cannot get the widget rows to observe the changes
in the data due to an input in one of the rows.
Well, I could call setAdapter() again each time the user types a keystroke,
but then the EditText widget where the user was
typing would lose the focus and refreshing the whole list rather than
refreshing just the list views is inefficient. The problem seems
to be I cannot set an observer on the rows to call after I change the
underlying Map data model.

Any ideas on what I should do?

Thanks,

John Goche

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

Reply via email to