Problem with Preference - OutOfMemory Error

by Vanraj » Wed, 29 Jul 2009 10:50:57 GMT


Sponsored Links
 Hello All,

I am getting some strange problem.

I am having one

class ABC extends PreferenceCategory .. and this ABC class is added in
preference xml and drawing the UI from that XML.

Now based on events i am adding and removing the children Preference from
the PreferenceCategory(ABC).

Like

ABC abc = new ABC(); // this is PreferenceCategory

// based on events
Preference myPref = new Preference();
abc.addPreference(myPref);
*or*
abc.removePreference(myPref);

this all works fine. But when i added my class which is extending the
Preference .

*

public* *class* MyClass *extends* Preference{

*public* MyClass(Context context) {

*             super*(context);

            }

}

and code is same just object changed
*Preference myPref = new MyClass();*
*// based on events*
abc.addPreference(myPref);
or
abc.removePreference(myPref);

And i will get *out of memory error* after some time.  This sound stupid but
it is true. Now *in case of MyClass if i use CheckBoxPreference* *as it is
extending Preference i am not getting error and there is no VM Heap size
grow while running the apps*. So what is wrong with *MyClass . i am not
doing any special things in that.*

-- 
/ Vanraj

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Looking for an Android compatible device on the cheap. Is this one?

I was looking at Zipit Wireless's Z2 messenger device ($150), and it
seems to
fit all the hardware requirements for Android, so I was wondering if a
port is possible?

Processor:
Marvell XScale PXA270 (FWPXA270C5C312) ARM running at 312MHz min.
(euedge.com reported that "Android should run on any device with an
ARMv5TE
CPU")

Ram: 32MB
(Android wiki reports "the minimum requirements for Android handsets
are 32 MB of RAM, 32 MB of flash memory, and a 200 MHz online
processor.)

Flash: 8MB in single 64Mb (4Mb x 16) FLASH chip
Flash is only 8MB, but it could probably be augmented by the mini-sd
slot.

A big plus, the manufacturer's opened up the platform and it already
runs linux (some version of OpenEmbedded I think).
I'm no expert, so I'm asking, have I just found the cheapest Android
development platform available?

Linux Journal Video Review:
http://www.linuxjournal.com/node/1005995

Developer Site:
http://linux.zipitwireless.com/
--~--~---------~--~----~------------~-------~--~----~

2. Creating a library (jar) with custom components (resources, views, etc)

I'm trying to create a utility library for android which will house
some common custom components that I will use in various other android
projects.
I use Eclipse for my development, and I tried simply making another
Android project with a MockContext class in it that I would use to get
the resources from.  But it doesn't seem to be working right out of
the starting gate.
So before performing more tests, I thought I'd ask the forum if anyone
has any simple solutions as to how to create these libraries, and link
them to other projects.
I have seen other posts with related questions, but no concrete
solutions.

Thanks in advance for your suggestions
--~--~---------~--~----~------------~-------~--~----~

3. Working with files

4. tracview: "Qemu trace files not supported yet."

5. SSLContext SSL implementation not found

6. disable double-tap in WebView?

7. Remote Update Application - Android