Re: [android-developers] Re: Memory management issue - outOfMemory exception

2012-03-31 Thread Mark Murphy
On Sat, Mar 31, 2012 at 7:14 AM, Farhan Tariq  wrote:
> I have made a UI that has images with varying heights, but constant width,
> added to each inner linearLayout (having vertical orientation). This way, I
> am able to add images without spaces occuring due to different heights.
> Using a listView that has 3 images of different heights added horizontally
> in a row, I will get empty spaces in a row, and I want to avoid them. So
> listView would not serve the purpose.

If you have three images of varying heights in a horizontal row, you
"will get empty spaces in a row", regardless of whether the row is in
a ListView or a ScrollView or anything else.

You appear to be comparing apples (three images in a vertical
LinearLayout) with oranges (three images in a horizontal LinearLayout
in a ListView row).

Regardless, ScrollView does not offer much that will help you in the
way of trying to hack in a recycling model. Whether you use an
existing AdapterView (e.g., ListView) or roll your own, I suspect that
is your clearest path to a solution.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.5
Available!

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


Re: [android-developers] Re: Memory management issue - outOfMemory exception

2012-03-31 Thread Farhan Tariq
I have made a UI that has images with varying heights, but constant width,
added to each inner linearLayout (having vertical orientation). This way, I
am able to add images without spaces occuring due to different heights.
Using a listView that has 3 images of different heights added horizontally
in a row, I will get empty spaces in a row, and I want to avoid them. So
listView would not serve the purpose.

On Sat, Mar 31, 2012 at 4:00 PM, Mark Murphy wrote:

> On Sat, Mar 31, 2012 at 6:54 AM, Farhan Tariq 
> wrote:
> > I have one LinearLayout as child of the scrollView, and that linearLayout
> > has 3 linear layouts that I am adding images to. Now, I can't figure out
> how
> > to handle memory issues.
>
> *Why* are you using a ScrollView instead of a ListView? A ListView
> with all disabled rows should be indistinguishable from a ScrollView
> to the user (off the top of my head), and it gives you the ability to
> recycle your views.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_ Version 2.5
> Available!
>
> --
> 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 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

Re: [android-developers] Re: Memory management issue - outOfMemory exception

2012-03-31 Thread Mark Murphy
On Sat, Mar 31, 2012 at 6:54 AM, Farhan Tariq  wrote:
> I have one LinearLayout as child of the scrollView, and that linearLayout
> has 3 linear layouts that I am adding images to. Now, I can't figure out how
> to handle memory issues.

*Why* are you using a ScrollView instead of a ListView? A ListView
with all disabled rows should be indistinguishable from a ScrollView
to the user (off the top of my head), and it gives you the ability to
recycle your views.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.5
Available!

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


Re: [android-developers] Re: Memory management issue - outOfMemory exception

2012-03-31 Thread Farhan Tariq
I have one LinearLayout as child of the scrollView, and that linearLayout
has 3 linear layouts that I am adding images to. Now, I can't figure out
how to handle memory issues.

On Sat, Mar 31, 2012 at 12:12 PM, Zsolt Vasvari  wrote:

> A ScrollView can only contain ONE child view.  So no, it's not possible
> with View based objects.  You could implement some kind of caching , but
> when you go through all that trouble, you will realize that it's easier to
> just use a ListView.
>
>
>
> On Saturday, March 31, 2012 7:06:51 AM UTC+8, Farhan wrote:
>>
>> I know it can be achieved usiing listViews, but how do I reuse views in
>> scrollView?? Is that possible at all?
>>
>> On Sat, Mar 31, 2012 at 3:35 AM, lbendlin  wrote:
>>
>>> use a listview and re-use the rows.
>>>
>>>
>>> On Friday, March 30, 2012 5:06:50 PM UTC-4, Farhan wrote:

 Hello everyone,

 In my application, I have custom scrollView to which a lot of images
 get added. I get an "outOfMemoryException" exception. I know why I am
 getting it, but I cant think of how to fix it while using a scrollView, not
 a listView. Any suggesstions? Hope to get some help soon.

 Regards,

 Farhan

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

Re: [android-developers] Re: Memory management issue - outOfMemory exception

2012-03-31 Thread Zsolt Vasvari
A ScrollView can only contain ONE child view.  So no, it's not possible 
with View based objects.  You could implement some kind of caching , but 
when you go through all that trouble, you will realize that it's easier to 
just use a ListView.



On Saturday, March 31, 2012 7:06:51 AM UTC+8, Farhan wrote:
>
> I know it can be achieved usiing listViews, but how do I reuse views in 
> scrollView?? Is that possible at all?
>
> On Sat, Mar 31, 2012 at 3:35 AM, lbendlin  wrote:
>
>> use a listview and re-use the rows.
>>
>>
>> On Friday, March 30, 2012 5:06:50 PM UTC-4, Farhan wrote:
>>>
>>> Hello everyone,
>>>
>>> In my application, I have custom scrollView to which a lot of images get 
>>> added. I get an "outOfMemoryException" exception. I know why I am getting 
>>> it, but I cant think of how to fix it while using a scrollView, not a 
>>> listView. Any suggesstions? Hope to get some help soon.
>>>
>>> Regards,
>>>
>>> Farhan
>>>
>>  -- 
>> 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 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

Re: [android-developers] Re: Memory management issue - outOfMemory exception

2012-03-30 Thread Farhan Tariq
I know it can be achieved usiing listViews, but how do I reuse views in
scrollView?? Is that possible at all?

On Sat, Mar 31, 2012 at 3:35 AM, lbendlin  wrote:

> use a listview and re-use the rows.
>
>
> On Friday, March 30, 2012 5:06:50 PM UTC-4, Farhan wrote:
>>
>> Hello everyone,
>>
>> In my application, I have custom scrollView to which a lot of images get
>> added. I get an "outOfMemoryException" exception. I know why I am getting
>> it, but I cant think of how to fix it while using a scrollView, not a
>> listView. Any suggesstions? Hope to get some help soon.
>>
>> Regards,
>>
>> Farhan
>>
>  --
> 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 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

[android-developers] Re: Memory management issue - outOfMemory exception

2012-03-30 Thread lbendlin
use a listview and re-use the rows.

On Friday, March 30, 2012 5:06:50 PM UTC-4, Farhan wrote:
>
> Hello everyone,
>
> In my application, I have custom scrollView to which a lot of images get 
> added. I get an "outOfMemoryException" exception. I know why I am getting 
> it, but I cant think of how to fix it while using a scrollView, not a 
> listView. Any suggesstions? Hope to get some help soon.
>
> Regards,
>
> Farhan
>

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