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. OpenGL Orthographic Projection problems on emulator (rendering 1/4 size)

I seem to have found the bug.  The problem appears to be with how
Fixed Point numbers are used with glOrthox.  The specification is such
that glOrtho creates a relative number of "pixels" that can be used -
so no matter what the actual screen resolution is, you get to draw to
whatever you defined as your coordinate system in glOrtho.  This means
that instead of converting everything to FP (int << 16), you can just
put the regular int in for the width and height of the orthographic
projection and then use regular ints in your geometry.  This works
correctly on the device and in every opengl example I've seen, but the
emulator doesn't like it.  Here's what I found:

Testing landscape full screen 480x320

glOrthox(0, 480, 320, 0, 0, 1) and geometry using ints (320, 480)
works on device but not on emulator (1/2 length and width show up)
glOrthox(0, 480 << 16, 320 << 16, 0, 0, 1) and geometry using FP (320
<< 16, 480 << 16) works on both emulator and device
glOrthof(0, 480f, 320f, 0, 0, 1) and geometry using floats (320f x
480f) works on both emulator and device
glOrthof(0, 480f, 320f, 0, 0, 1) and geometry using FP (320 << 16, 480
<< 16) works on both emulator and device

I think it's a bug that the first method doesn't work, but I'll just
convert everything to FP and forget about it.



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

2. Resolution

Hi

I have created an application and I want to make sure it works in
different resolution.

 i have used LinearLayout and some ListViews and buttons.

I need to know will it be an issue if the apk is put to two different
phones which has different resolution.

thank u
--~--~---------~--~----~------------~-------~--~----~

3. Error while using Android Tool in the tools dir.

4. OpenGL Orthographic Projection problems on emulator (rendering 1/4 size)

5. Can anyone know how to setup an application to eeepc based on android?

6. Install LockScreen Hero

7. Capture Video on device (Video Recording Problem)