I have a scrollview
in which I have inflated the view dynamically (same as facebook wall of android app, there is an imageview
and textview
in it.).
All the images are dynamic. If I load too much data in it then I get outofmemory exception
. I know that listview
will solve my problem but I cannot use the listview
.
So, is there any way to optimize i.e recycle the views when they are not visible?
Asked
Active
Viewed 2,203 times
3

Ivan Ferić
- 4,725
- 11
- 37
- 47

user2074331
- 31
- 2
-
why can't you use listview? – Pedro Loureiro Feb 15 '13 at 12:10
-
my page is same as profile page of facebook android app.That is why i cannot use listview. – user2074331 Feb 15 '13 at 12:12
2 Answers
2
By your comments, I believe you still can use a list view:
A listview can have many different kinds of view. For more information on this, read Android ListView with different layouts for each row.
This way, views will be recycled and hopefully your memory usage will be smaller.
Anyway, I would probably investigate your code as I guess that for running out of memory, you probably are leaking objects or doing something way too many times than needed.

Community
- 1
- 1

Pedro Loureiro
- 11,436
- 2
- 31
- 37
1
you can not handle Errors in normal circumstance but you can use following techneques to remove thias errror
1-Please clear your Arraylist before item add .
2-Use garbage collection techniques
System.gc() or finalize method use for Memory reclaim from object.

Brajendra Pandey
- 2,280
- 1
- 16
- 22