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. RT2070 Android2.1 Issue

Hi,All,i met rt2070 issue on andoid2.1.
anyone can give some good advice?

1)init.rc

    mkdir /system/etc/wifi 0771 wifi wifi
    chmod 0771 /system/etc/wifi
    chmod 0660 /system/etc/wifi/wpa_supplicant.conf
    chown wifi wifi /system/etc/wifi/wpa_supplicant.conf

    mkdir /data/misc/wifi 0771 wifi wifi
    chmod 0771 /data/misc/wifi
    mkdir /data/misc/wifi/wpa_supplicant 0771 wifi wifi
    chmod 0771 /data/misc/wifi/wpa_supplicant

    chmod 0660 /data/misc/wifi/wpa_supplicant.conf
    mkdir /data/misc/wifi/sockets 0777 wifi wifi
    mkdir /data/misc/dhcp 0770 dhcp dhcp
    chown dhcp dhcp /data/misc/dhcp
    chmod 0777 /system/etc/Wireless/RT2870STA/
    chmod 0777 /system/etc/Wireless/RT2870STA/RT2870STA.dat

service wpa_supplicant /system/bin/wpa_supplicant -Dwext -ira0
-c/data/misc/wifi/wpa_supplicant.conf -dd
        user root
        group system wifi inet keystore
        disabled
        oneshot

service dhcpcd /system/bin/logwrapper /system/bin/dhcpcd -d ra0
        disabled
        oneshot
        group system dhcp wifi

on property:init.svc.wpa_supplicant=stopped
        stop dhcpcd


2)system/etc/wifi/wpa_supplicant.conf
ctrl_interface=DIR=/data/misc/wifi/wpa_supplicant GROUP=wifi
eapol_version=1
ap_scan=1
fast_reauth=1

3)
system/etc/dhcpcd/dhcpcd.conf

interface ra0
option subnet_mask, routers, domain_name_serv

4)e
android$ vim hardware/libhardware_legacy/wifi/wifi.c
static const char IFACE_DIR[]           = "/data/misc/wifi/wpa_supplicant";

5)Boardconfig.mk
BOARD_WPA_SUPPLICANT_DRIVER := WEXT

WIFI_DRIVER_MODULE_PATH :=/system/lib/modules/rt3070sta.ko
WIFI_DRIVER_MODULE_NAME:=rt3070sta


# ls /data/misc/ -l
drwxrwx--- bluetooth bluetooth          2010-02-22 13:30 bluetoothd
drwx------ keystore keystore          2010-02-22 13:30 keystore
drwxrwx--- system   system            2010-02-22 13:30 vpn
drwxrwx--x wifi     wifi              2010-02-22 13:53 wifi
drwxrwx--- dhcp     dhcp              2010-02-22 13:30 dhcp

# ls /data/misc/wifi -l
# ls -l
drwxrwx--x wifi     wifi              2010-02-22 13:56 wpa_supplicant
drwxrwxrwx wifi     wifi              2010-02-22 13:56 sockets
-rw-rw---- system   wifi        29658 2010-02-22 13:32 wpa_supplicant.conf



i have granted permission to wifi communication,why also say can not connect
issue?


But following issue:
D/SettingsWifiEnabler( 1930): Received wifi state changed from Disabled to
Enabling
[ 1371.988702] rtusb init --->
[ 1371.990961]
[ 1371.990968]
[ 1371.990972] === pAd = ccb02000, size = 462912 ===
[ 1371.990979]
[ 1371.995048] <-- RTMPAllocAdapterBlock, Status=0
[ 1372.002469] ra0 (usb): not using net_device_ops yet
[ 1372.008687] usbcore: registered new interface driver rt2870
D/WifiService( 1856): ACTION_BATTERY_CHANGED pluggedType: 1
E/WifiHW  ( 1856): Unable to open connection to supplicant on
"/data/misc/wifi/wpa_supplicant/ra0": No such file or directory
D/SettingsWifiEnabler( 1930): Received wifi state changed from Enabling to
Enabled
[ 1376.985871] <-- RTMPAllocTxRxRingMemory, Status=0
[ 1377.008613] -->RTUSBVenderReset
[ 1377.010622] <--RTUSBVenderReset

-- 
our psychological growth is the movement from dependence to independence  to
interdependence!

-- 

2. Adding application to the source code

Hi all,

I want to modify Android sources to use a particular application I
made at some point, for research purposes.
I made my application and I know where I need to modifiy Android
sources to use it, but I do not know how to add the application I made
to the sources (other than adb install, because I want it to be, like
the other apps, in package/apps/) to be able to call my app anywhere
in the java part of the sources via an intent.
I tried to add src/ folder to the build path, but its only adidng my
app in the root part, plus res/ file is not embedded/added in this
process...How can i do that?

Best regards,

Guillaume

-- 

3. Sensitivity of SCROLL_STATE_FLING event

4. How to listen for ACTION_EXTERNAL_APPLICATIONS_AVAILABLE while Move2SD is enabled?

5. Emulator crashes when launching a new Activity

6. Can we access Java.util Map of a class in another class

7. Android 2.3 emulator crashed after a requestLocationUpdates call