Tuesday, February 11, 2014

Custom Adapter getView number of calls in question


            
A ListView, each Item to display an ImageView and two TextView, so to write a Adapter. But when debugging found that when the data is only one time, getView function call will be repeated several times, resulting in a slower refresh the interface. And ImageView picture is loaded asynchronously, if the call will be repeated several times to create a load of threads, a waste of resources. How can we solve this problem?

Search the Internet was discussed this problem, the solution is to give the listview android: layout_height property is set to fill_parent, but still repeated calls getView.
Reply:
Nobody encountered? ~ ~ ~ ~
Reply:
Do not know, Bangding
Reply:
Should be the number of binding adapter getCount obtained, plus post Item number can be displayed per page calculated. You put getView code stickers out of it
Reply:
getCount returns the number of data, getView need to display data for each slide will be called
Reply:
getCount set right?
If it is right, please paste the code
Reply:
Leaving a concern, used custom Adapter, more complex
Reply:
Post code,,,,
Reply:
notifation can refresh listview Every time I go without re setadpter
Adpter case you want to rewrite your own baseadpter way, and then customize the listview control line size did not normally appear only one control

Reply:
You define a Bitmap array of resources to get to into this array, directly in getview in bitmap resources, pay attention to the release of bitmap
Reply:
getAdapter first argument if there is already loaded before the value of the
You are not to judge a null like
If not null direct return
Will be much faster
Reply:
Look what features you want to achieve, getview is called when the interface will change, such as when you flip up and down will recall getview methods.
Reply:
I also encountered a problem on the call getView () times, the situation is this, from a TabActivity realized through button to jump to a ListActivity, item number, I wrote it first to die, the test only three, this time the problem came out, the data can be displayed, but getView () method was called twice, when the number of item for a time, but also to call two times.
This is one, there is little, if I add an Activity when activity in the middle of these two, then add the Activity buttons that jump to ListActivity on time, getView method is called once, and if this is no middle Activity What event, which is just a simple jump to listactivity, then ListActivity also call two times getView () method
I wonder if the landlord does not solve the problem
Reply:
Layout problems http://blog.csdn.net/f8376904110/article/details/6460934
I also have this kind of problem, you look. .
Reply:
reference to the 13th floor futurebp reply:
layout problems http://blog.csdn.net/f8376904110/article/details/6460934
I also have this kind of problem, you look. .

Inside said makes sense, the landlord to see it. Bangding. . .
Reply:
13th floor to the website, very good, I hope for your help!
Reply:
The definition of a Bitmap array of resources to take into this array, directly in getview in bitmap resources, pay attention to the release of bitmap
Reply:
Thanks to the 13th floor!
Reply:
Thanks to the 13th floor to the website, the problem is resolved, the efficiency of a lot faster
Reply:
This is my gridView to display, and also set this up
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
When displayed with a listview, in the manner of address to the 13th floor to solve this problem, but with time gridView displayed this way but can not solve this problem, do not know any heroes know why! ! !
When displayed with gridView, getView () method is always invoked many times ah, solution! ! ! Emergency ...
Reply:
This is my gridView to display, and also set this up
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
When displayed with a listview, in the manner of address to the 13th floor to solve this problem, but with time gridView displayed this way but can not solve this problem, do not know any heroes know why! ! !
When displayed with gridView, getView () method is always invoked many times ah, solution! ! ! Emergency ...
Reply:
Top up. . . . . . . . . . .
Reply:
Tried it, the effect is so!
Reply:
The listview's android: layout_height attribute set to fill_parent, tried it did not repeat calls getView the
.
Reply:
Will the landlord: When gridView with display, getView () method is always invoked many times what this issue is resolved there, ah, I have encountered this problem

No comments:

Post a Comment