Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-04 Thread saex
public class CustomExpandableListAdapter extends BaseExpandableListAdapter 
{ 
AbsListView.LayoutParams lp = new 
AbsListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, 
ViewGroup.LayoutParams.WRAP_CONTENT);
SpannableString spanString=null;

String[] groups;
String[][] children;
Context context;

public CustomExpandableListAdapter(Context context, String[] groups, 
String[][] children) {
super();
this.groups = groups;
this.children = children;
this.context = context;
}

public Object getChild(int groupPosition, int childPosition) {
return children[groupPosition][childPosition];
}

public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}

public int getChildrenCount(int groupPosition) {
return children[groupPosition].length;
}

public TextView getGenericView() {
TextView textView = new TextView(context);
textView.setLayoutParams(lp); 
textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
return textView;
}
 
public View getChildView(int groupPosition, int childPosition, boolean 
isLastChild, View convertView, ViewGroup parent) {
TextView auxTextView = getGenericView();
auxTextView.setText(Html.fromHtml(getChild(groupPosition, 
childPosition).toString()));
auxTextView.setTextSize(Util.CHILD_TEXT_SIZE);   
auxTextView.setPadding(20, 10, 20, 10);
auxTextView.setTextColor(Util.FONT_COLOR_CHILD);
return auxTextView;
}

public View getGroupView(int groupPosition, boolean isExpanded, View 
convertView, ViewGroup parent) {
TextView auxTextView = getGenericView();
auxTextView.setTextSize(24);
auxTextView.setPadding(10, 10, 10, 10);
auxTextView.setTextColor(Util.FONT_COLOR_PARENT);

spanString = new 
SpannableString(getGroup(groupPosition).toString());
spanString.setSpan(new StyleSpan(Typeface.BOLD), 0, 
spanString.length(), 0);
spanString.setSpan(new StyleSpan(Typeface.ITALIC), 0, 
spanString.length(), 0);
auxTextView.setText(spanString);

return auxTextView;
}

public Object getGroup(int groupPosition) {
return groups[groupPosition];
}

public int getGroupCount() {
return groups.length;
}

public long getGroupId(int groupPosition) {
return groupPosition;
}

public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}

public boolean hasStableIds() {
return true;
}
}

El lunes, 4 de febrero de 2013 20:11:57 UTC+1, skink escribió:
>
>
>
> saex wrote: 
> > OK, Sorry guys, now i understand you 
> > 
> > I tryed using your answers to get the solution but it doesn't works by 
> now, 
> > i don't know what i'm doing wrong 
> > 
> > This is the code now (this code is on the handler that is being called 
> each 
> > second from a thread). el is the expandableListView and mAdapter is the 
> > adapter for the expandableListView 
> > 
> > TextView tv = (TextView) mAdapter.getChildView(1, 0, true, 
> > (TextView)el.getChildAt(1),  el); 
> >  tv.setText("My New Text"); 
> > 
> > The child is not changing, so something is going wrong... :/ 
> > 
> > 
> > 
>
> what adapter are you extending? 
>
> pskink 
>

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-04 Thread skink


saex wrote:
> OK, Sorry guys, now i understand you
>
> I tryed using your answers to get the solution but it doesn't works by now,
> i don't know what i'm doing wrong
>
> This is the code now (this code is on the handler that is being called each
> second from a thread). el is the expandableListView and mAdapter is the
> adapter for the expandableListView
>
> TextView tv = (TextView) mAdapter.getChildView(1, 0, true,
> (TextView)el.getChildAt(1),  el);
>  tv.setText("My New Text");
>
> The child is not changing, so something is going wrong... :/
>
>
>

what adapter are you extending?

pskink

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-04 Thread saex
OK, Sorry guys, now i understand you

I tryed using your answers to get the solution but it doesn't works by now, 
i don't know what i'm doing wrong

This is the code now (this code is on the handler that is being called each 
second from a thread). el is the expandableListView and mAdapter is the 
adapter for the expandableListView

TextView tv = (TextView) mAdapter.getChildView(1, 0, true, 
(TextView)el.getChildAt(1),  el);
 tv.setText("My New Text");

The child is not changing, so something is going wrong... :/


El sábado, 2 de febrero de 2013 09:44:25 UTC+1, skink escribió:
>
>
>
> Lew wrote: 
> > saex wrote: 
> > 
> > > argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it 
> is 
> > > not the problem, read the full post please 
> > >> 
> > >> 
> > >> 
> > Instead of bitching and shouting at everyone trying to help you for 
> free, 
> > which is a pretty 
> > darn good way to stop receiving free help altogether as people start to 
> > resent your 
> > chastisements, how about you 
> > - attempt to follow their advice, and 
> > - post an SSCCE http://sscce.org/ illustrating your attempt. 
> > 
> > Follow this advice also: 
> > http://www.catb.org/esr/faqs/smart-questions.html 
> > 
> > -- 
> > Lew 
>
> and of course good old Google is his friend, quick search like this: 
>
> http://www.google.com/m?q=android+listview+update+single+item 
>
> shows some SO answers, for ex: 
>
>
> http://stackoverflow.com/questions/2123083/android-listview-refresh-single-row
>  
>
> pskink 
>

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-02 Thread skink


Lew wrote:
> saex wrote:
>
> > argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it is
> > not the problem, read the full post please
> >>
> >>
> >>
> Instead of bitching and shouting at everyone trying to help you for free,
> which is a pretty
> darn good way to stop receiving free help altogether as people start to
> resent your
> chastisements, how about you
> - attempt to follow their advice, and
> - post an SSCCE http://sscce.org/ illustrating your attempt.
>
> Follow this advice also:
> http://www.catb.org/esr/faqs/smart-questions.html
>
> --
> Lew

and of course good old Google is his friend, quick search like this:

http://www.google.com/m?q=android+listview+update+single+item

shows some SO answers, for ex:

http://stackoverflow.com/questions/2123083/android-listview-refresh-single-row

pskink

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread Lew
saex wrote:

> argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it is 
> not the problem, read the full post please
>>
>>
>>
Instead of bitching and shouting at everyone trying to help you for free, 
which is a pretty 
darn good way to stop receiving free help altogether as people start to 
resent your 
chastisements, how about you 
- attempt to follow their advice, and
- post an SSCCE http://sscce.org/ illustrating your attempt.

Follow this advice also:
http://www.catb.org/esr/faqs/smart-questions.html

-- 
Lew

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread Nobu Games
Your Adapter has these 
getChildView and 
getGroupView methods. Both these 
methods have an argument called "*convertView*". That "*convertView*" 
argument is a view object that already has been created and filled with 
data by your adapter. If convertView is *not null* your Adapter should 
reuse that object instead of inflating or creating a new view.

And that's the whole point and one possible solution to your problem. You 
can "manually" do the same what ListAdapter does under the hood. Just get 
the correct child view you want to update and pass that child view as 
"convertView" argument to your adapter's getChildView method (with the 
correct group index and child item position of course). If your adapter is 
correctly programmed it will reuse that existing view object and just fill 
it with the correct data to display.

However, you may experience update errors while scrolling quickly through 
your listview. There are workarounds possible by using a scroll listener. 
When your listener detects a "fling" that causes fast scrolling, you could 
stop your updates, because they won't be visible anyway. You could also 
generally stop updates while the user is scrolling.

Now to the real question: why is scrolling your list view so slow? Even 
with using notifyDataSetChanged it shouldn't slow down that much because 
ListView only updates the currently visible list items and that's it.

What exactly does your adapter do in getChildView and getGroupView? Does it 
query a database? Does it decode bitmap objects? Does it read data from a 
file?
What does "getUpdateInfo" do?

You should create and update the adapter data only in a background thread. 
The UI thread should not be burdened with anything that might be blocking 
(like network or file I/O, database access, bitmap loading...). Is your 
handler code in your first post invoked on the UI thread? If so, you should 
move this update to a background thread that is continuously running and 
pausing for a second. When the activity is paused that thread should be 
stopped.

On Friday, February 1, 2013 1:37:05 PM UTC-6, saex wrote:
>
> What? where should i put that view? i dont understand you...
>
> the objective is to update one item instead of rebuilding the entire 
> {expandable} list view.
>
> So... what should i do with that view? how can i make that view to be 
> refreshed when i want?
>
> i'm stuck
>
> El viernes, 1 de febrero de 2013 18:19:57 UTC+1, Kostya Vasilyev escribió:
>>
>> And if you can't call getChildView, just copy the code from there to 
>> where you need it.
>>
>> (Can't believe I wrote "copy the code"... will my developer license be 
>> revoked now?)
>>
>> -- K
>>
>> 2013/2/1 skink 
>>
>>>
>>>
>>> saex wrote:
>>> > argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it 
>>> is
>>> > not the problem, read the full post please
>>> >
>>> >
>>>
>>> i did read the full thread and still i think you should call
>>> getChildView as Kostya suggested
>>>
>>>
>>> pskink
>>>
>>> --
>>> --
>>> 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+unsubscr...@googlegroups.com
>>> 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 android-developers+unsubscr...@googlegroups.com.
>>> 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 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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread skink


saex wrote:
> What? where should i put that view? i dont understand you...
>
> the objective is to update one item instead of rebuilding the entire
> {expandable} list view.
>
> So... what should i do with that view? how can i make that view to be
> refreshed when i want?
>
>

its simple: if your child view (I assume you can somehow get child
view as you said) is for example TextView simply call setText()

pskink

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread saex
What? where should i put that view? i dont understand you...

the objective is to update one item instead of rebuilding the entire 
{expandable} list view.

So... what should i do with that view? how can i make that view to be 
refreshed when i want?

i'm stuck

El viernes, 1 de febrero de 2013 18:19:57 UTC+1, Kostya Vasilyev escribió:
>
> And if you can't call getChildView, just copy the code from there to where 
> you need it.
>
> (Can't believe I wrote "copy the code"... will my developer license be 
> revoked now?)
>
> -- K
>
> 2013/2/1 skink >
>
>>
>>
>> saex wrote:
>> > argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it is
>> > not the problem, read the full post please
>> >
>> >
>>
>> i did read the full thread and still i think you should call
>> getChildView as Kostya suggested
>>
>>
>> pskink
>>
>> --
>> --
>> 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+unsubscr...@googlegroups.com 
>> 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 android-developers+unsubscr...@googlegroups.com .
>> 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 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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread Kostya Vasilyev
And if you can't call getChildView, just copy the code from there to where
you need it.

(Can't believe I wrote "copy the code"... will my developer license be
revoked now?)

-- K

2013/2/1 skink 

>
>
> saex wrote:
> > argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it is
> > not the problem, read the full post please
> >
> >
>
> i did read the full thread and still i think you should call
> getChildView as Kostya suggested
>
>
> pskink
>
> --
> --
> 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
> ---
> 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+unsubscr...@googlegroups.com.
> 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 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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread skink


saex wrote:
> argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it is
> not the problem, read the full post please
>
>

i did read the full thread and still i think you should call
getChildView as Kostya suggested


pskink

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread saex
argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it is 
not the problem, read the full post please

El viernes, 1 de febrero de 2013 17:10:53 UTC+1, skink escribió:
>
>
>
> saex wrote: 
> > I see, but i can't understand how to do what i need to do... 
> > 
> > 
>
> just call getChildView 
>
> pskink 
>

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread skink


saex wrote:
> I see, but i can't understand how to do what i need to do...
>
>

just call getChildView

pskink

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread saex
I see, but i can't understand how to do what i need to do...

El viernes, 1 de febrero de 2013 16:03:17 UTC+1, skink escribió:
>
>
>
> saex wrote: 
> > arg... you didn't understand me or i can't understand you 
> > 
> > getChildView and getGroupView are from the ExpandableListView, but we 
> are 
> > talking about the Adapter, 
>
> no, see 
> http://developer.android.com/reference/android/widget/ExpandableListAdapter.html
>  
>
> pskink 
>

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread skink


saex wrote:
> arg... you didn't understand me or i can't understand you
>
> getChildView and getGroupView are from the ExpandableListView, but we are
> talking about the Adapter,

no, see 
http://developer.android.com/reference/android/widget/ExpandableListAdapter.html

pskink

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread saex
arg... you didn't understand me or i can't understand you

getChildView and getGroupView are from the ExpandableListView, but we are 
talking about the Adapter,

i dont know how to update only the view of only the two childs i want to 
update, please, can you give me code example of what you want to say to me? 
i can't understand

El viernes, 1 de febrero de 2013 13:08:36 UTC+1, Kostya Vasilyev escribió:
>
> Urm, for an expandable list view -- getChildView or getGroupView.
>
> -- K
>
> 2013/2/1 saex >
>
>> 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 
>>>
>>> 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.**getFirstVisib**lePosition();
> final int nLast = mAccountListView.**getLastVisibl**ePosition();
>  for (int position = nFirst; position <= nLast; ++position) {
>
> View itemView = mAccountListView.getChildAt(**po**sition - 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 
>
> 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 
>>>
  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-

Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread Kostya Vasilyev
Urm, for an expandable list view -- getChildView or getGroupView.

-- K

2013/2/1 saex 

> 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 
>>
>> 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.**getFirstVisib**lePosition();
 final int nLast = mAccountListView.**getLastVisibl**ePosition();
  for (int position = nFirst; position <= nLast; ++position) {

 View itemView = mAccountListView.getChildAt(**po**sition - 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 

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

Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread saex
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 >
>
>> 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 
>>>
>>> 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 
>
>>  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
>> --- 
>> 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
>> .
>>  
>>  
>>
>
>  -- 
 -- 
 You received t

Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread Kostya Vasilyev
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 

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

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

  --
>>> --
>>> 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+**unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**g

Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread saex
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 >
>
>> 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 
>>>
  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+**unsubscr...@googlegroups.com
 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 android-developers+**unsubscr...@googlegroups.com.
 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 
>> android-d...@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
>> --- 
>> 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+

Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread Kostya Vasilyev
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 

> 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 
>>
>>>  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+**unsubscr...@googlegroups.com
>>> 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 android-developers+**unsubscr...@googlegroups.com.
>>> 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 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
> ---
> 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+unsubscr...@googlegroups.com.
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this grou

Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread saex
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 >
>
>>  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+unsubscr...@googlegroups.com 
>> 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 android-developers+unsubscr...@googlegroups.com .
>> 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 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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread Kostya Vasilyev
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 

> 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-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
> ---
> 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+unsubscr...@googlegroups.com.
> 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 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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?

2013-02-01 Thread TreKing
On Fri, Feb 1, 2013 at 2:36 AM, saex  wrote:

> think that it is because this call ((BaseExpandableListAdapter)
> mAdapter).notifyDataSetChanged(); is updating all the ExpandableListView.
>
Don't *think*. Profile your code and determine what is really causing your
slowness. Then fix that.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.