i didn't understand you, the adapter doesn't have a getView method

El viernes, 1 de febrero de 2013 12:50:46 UTC+1, Kostya Vasilyev escribió:
>
> Is that it?
>
> >> 
>
> You could call the adapter's getView, making sure to pass the existing 
> view as the "convertView".
>
> <<
>
> -- K
>
> 2013/2/1 saex <[email protected] <javascript:>>
>
>> i know how to get the views, the problems is that i can't reach the way 
>> to tell the adapter to update the content of only these views... did you 
>> know?
>>
>> thanks
>>
>> El viernes, 1 de febrero de 2013 12:37:51 UTC+1, Kostya Vasilyev escribió:
>>>
>>> Might look something like this:
>>>
>>> final int nFirst = mAccountListView.**getFirstVisiblePosition();
>>> final int nLast = mAccountListView.**getLastVisiblePosition();
>>>  for (int position = nFirst; position <= nLast; ++position) {
>>>
>>> View itemView = mAccountListView.getChildAt(**position - nFirst);
>>>
>>> As for asking the adapter to update the view, well, there isn't a direct 
>>> way to do this. You could call the adapter's getView, making sure to pass 
>>> the existing view as the "convertView".
>>>
>>> Or just "reach into" the content of your item layout (findViewById, 
>>> ViewHolder) and update the values.
>>>
>>> If the number of items in the adapter can change dynamically, it gets 
>>> more complicated, as the list view can be out of sync with the adapter.
>>>
>>> And remember, this can be considered an ugly hack that violates the holy 
>>> principles of Objectively Orientated Progammation (or whatever that thing 
>>> is called) :)  -- but can be useful where performance is important.
>>>
>>> -- K
>>>
>>> 2013/2/1 saex <[email protected]>
>>>
>>> OK, i can get the childs View with:
>>>>
>>>> el.getChildAt(1);
>>>> el.getChildAt(2);
>>>>
>>>> but... what shouild i do to notify these views that they must reload 
>>>> their content from the adapter?
>>>>
>>>> El viernes, 1 de febrero de 2013 11:38:42 UTC+1, Kostya Vasilyev 
>>>> escribió:
>>>>>
>>>>> While TreKing's advice to profile is of course excellent...
>>>>>
>>>>> ...rebuilding the entire {expandable} list view just to update one 
>>>>> item is more work that necessary.
>>>>>
>>>>> When performance is important, you can walk the list of visible item 
>>>>> views, find the one you need to update, and do it right there. You will 
>>>>> want to use listView.getFirstVisibleItem / getLastVisibleItem / getChild.
>>>>>
>>>>> Also there is a callback, AbsListView.onScrollListener, which lets you 
>>>>> know when the list view is scrolling, and perhaps suspend your updates if 
>>>>> necessary.
>>>>>
>>>>> -- K
>>>>>
>>>>> 2013/2/1 saex <[email protected]>
>>>>>
>>>>>>  I have a ExpandableListView with some groups, and each group haves 
>>>>>> only one child, with a string on it.
>>>>>>
>>>>>> I have a thread that get's some updated data and *each second* calls 
>>>>>> a handler that updates the string of one of the childs of the 
>>>>>> ExpandableListView and then calls this method to refresh the view and 
>>>>>> show 
>>>>>> the updated data to the user: ((BaseExpandableListAdapter) mAdapter).
>>>>>> **notifyDataSetChanged**();
>>>>>>
>>>>>> This is the update handler:
>>>>>>
>>>>>> infoUpdateHandler = new Handler(){
>>>>>>             @Override
>>>>>>             public void handleMessage(Message msg) {
>>>>>>                 super.handleMessage(msg);   
>>>>>>                 children[2][0]=getUpdatedInfo(****);
>>>>>>                 ((BaseExpandableListAdapter) 
>>>>>> mAdapter).notifyDataSetChanged****();
>>>>>>             }
>>>>>>         };
>>>>>>
>>>>>> The problem is that when i'm scrolling the expandable list view, i 
>>>>>> can see how the scroll is showing low performance, it stops sometimes. I 
>>>>>> think that it is because this call ((BaseExpandableListAdapter) 
>>>>>> mAdapter).**notifyDataSetChanged**(); is updating all the 
>>>>>> ExpandableListView. 
>>>>>>
>>>>>> *Does not exist a better way to update a expandable list view? Maybe 
>>>>>> a way to update only the child that you want to update?*
>>>>>>
>>>>>> Thanks
>>>>>>  
>>>>>> -- 
>>>>>> -- 
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Android Developers" group.
>>>>>> To post to this group, send email to android-d...@**googlegroups.com
>>>>>>
>>>>>> To unsubscribe from this group, send email to
>>>>>> android-developers+**unsubscribe**@googlegroups.com
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/**group**/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>>>>>> --- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "Android Developers" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to android-developers+**unsubscribe**@googlegroups.com.
>>>>>> For more options, visit 
>>>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out>
>>>>>> .
>>>>>>  
>>>>>>  
>>>>>>
>>>>>
>>>>>  -- 
>>>> -- 
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Android Developers" group.
>>>> To post to this group, send email to android-d...@**googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> android-developers+**[email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Android Developers" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to android-developers+**[email protected].
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>  
>>>>  
>>>>
>>>
>>>  -- 
>> -- 
>> 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]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Android Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to