BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 09-18-2009, 10:48 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Aug 2007
Model: 8100
PIN: N/A
Carrier: cingular
Posts: 33
Post Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Static reference returning different values every time

Please Login to Remove!

Hi,

I’m developing an application to log call data on Blackberry Bold -9000. The application works as both ‘foreground’ and ‘background’ application.

The call data is being stored in a ‘static Vector’.

But when I try to check the data stored in the ‘Vector’, it returns different set of values in both states.

I also tried checking the ‘hashCode ()’ value of the reference and they were also different between the two states.

Please let me know any other setting to correct this issue.
Code:
---Application Main file---
PhoneLogs.addListener(new Log1());

---Screen File ---
extends MainScreen
public static Vector vector=new Vector();
protected void paint(Graphics graphics) {    	
    	System.out.println(vector);
    	super.paint(graphics);
    }

-----Log file ----
implements PhoneLogListener
public void callLogAdded(CallLog cl) {
        try {
        Screen1.vector.addElement(cl);
        System.out.println(Screen1.vector);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
Offline  
Old 09-19-2009, 11:36 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

There is no setting to fix this. It has to do with the way the RIM OS marshals the data context for different processes.

In the CallLog listener, you are in a completely separate context from your "mainScreen" class.

There are two ways to work around this: 1) use the RuntimeStore to create a singleton, or 2) from the CallLog to fire a global event, which you will catch in your own app context (with eventListener) and from there get the correct copy of the Vector.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Rohm BA5412 Dual Audio Power Amplifier Integrated Circuit - NOS Qty 1
$9.99
Rohm BA5412 Dual Audio Power Amplifier Integrated Circuit - NOS Qty 1  pictureTape of 25 RF Micro Devices RFMD RF2314 .15 - 2.5 GHz Low Noise Amplifier - NEW
$25.0
Tape of 25 RF Micro Devices RFMD RF2314 .15 - 2.5 GHz Low Noise Amplifier - NEW pictureAN7266 Matsushita AM Tuning FM-AM IF Amplifier Consumer IC Plastic NOS Qty 1
$5.99
AN7266 Matsushita AM Tuning FM-AM IF Amplifier Consumer IC Plastic NOS Qty 1 pictureSanyo LA4461N 12W Audio Power Amplifier Integrated Circuit NOS Qty 1
$7.5
Sanyo LA4461N 12W Audio Power Amplifier Integrated Circuit NOS Qty 1  pictureSGS TDA2008 Audio Amplifier 12W IC TO-220 - NOS Qty 3
$20.0
SGS TDA2008 Audio Amplifier 12W IC TO-220 - NOS Qty 3  picture






Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.