BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 03-15-2008, 05:30 PM   #1
BMF
New Member
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: att
Posts: 2
Default PhoneCallLogID context is always Null in run() menu

Please Login to Remove!

Hi

I just started programming in the BlackBerry and I was trying to adapt the MenuItem Demo from JDE to add a menu item to the phone application, I would like to get information of the number that was dialed before, but when I select it the context variable is always null, in the menu run().

What am I doing wrong?

Code:
package com.rim.samples.menuitem;

import java.lang.*;
import java.util.*;
import net.rim.blackberry.api.menuitem.*;
import net.rim.blackberry.api.mail.*;
import net.rim.blackberry.api.pim.*;

//import net.rim.device.api.system.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.blackberry.api.phone.*;
import net.rim.blackberry.api.phone.phonelogs.*;

/*
 * MenuItemDemo application
 * This registers a simple menu item with the system to be shown
 * when viewing an email Message. The run method for this menuItem
 * simply gets the message for use
 *
 * Copyright (C) 2003 Research In Motion Ltd.
 */

class MenuItemDemo {
    
    public static void main(String[] args){
        System.out.println("Starting MyMenuItemDemo");
        PhoneLogs _logs = PhoneLogs.getInstance();
        (new MyMenuItem(0)).registerInstance();
    }
}

class MyMenuItem extends ApplicationMenuItem
{
    private PhoneLogs _logs;
    
    // we'll use the default constructors here.
    MyMenuItem(int order){
        super(order);
    }

    // Register the instance of the menuItem with the system
    public void registerInstance(){
        System.out.println("Registering MyMenuItemDemo");
        _logs = PhoneLogs.getInstance();
        ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_PHONELOG_VIEW,this);
        ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_PHONE,this);
    }

    //methods we must implement
    //Run is called when the menuItem is invoked
    public Object run(Object context) {

        // Adding a breakpoint here context is always null!!!!
        if (context instanceof PhoneCallLogID) {
            try {
                PhoneCallLogID pCall = (PhoneCallLogID) context;
                Dialog.inform("Call to "+pCall.getNumber());
            } catch (Exception ex) {
                Dialog.alert(ex.getClass().getName() + ": " + ex.getMessage());
            }
        }

        return context;
    }

    //toString should return the string we want to
    //use as the lable of the menuItem
    public String toString(){
        return "My Menu";
    }

}
__________________
---
Do It Right or Don't do it at all.
Offline  
Old 03-16-2008, 02:27 PM   #2
jobsolle
New Member
 
Join Date: May 2007
Model: 8707
PIN: N/A
Carrier: vodafone
Posts: 6
Default

I have the same problem. It just doesn't work. I'm using 4.2.
Offline  
Old 03-17-2008, 04:50 AM   #3
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

You have to wait for 4.5, i had the same problem some time ago:
Quote:
Originally Posted by RIM Support
The specific scenario that you have reported seems fixed in v4.5 of the handheld code
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 03-17-2008, 05:25 AM   #4
jfisher
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Default

'seems' - that doesn't inspire confidence.
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 03-17-2008, 07:34 PM   #5
BMF
New Member
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: att
Posts: 2
Default

When will 4.5 be available for the handheld and emulator?
__________________
---
Do It Right or Don't do it at all.

Last edited by BMF; 03-17-2008 at 07:35 PM..
Offline  
Old 03-18-2008, 07:38 AM   #6
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

take a look at the speculation forum, can be out anytime soon.
all i can say is that my coworkers installed 4.5 on their devices on the CeBit.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 06-12-2008, 11:10 AM   #7
lePin
New Member
 
Join Date: Jun 2008
Model: 7100T
PIN: N/A
Carrier: none
Posts: 13
Default

Quote:
Originally Posted by BMF View Post
Hi

I just started programming in the BlackBerry and I was trying to adapt the MenuItem Demo from JDE to add a menu item to the phone application, I would like to get information of the number that was dialed before, but when I select it the context variable is always null, in the menu run().

What am I doing wrong?

Code:
ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_PHONELOG_VIEW,this);
ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_PHONE,this);
You have registred two MenuItems, so only the second one works properly. As documented, it does not send any object to your application.

But I have no idea why a custom menu isn't registered in the phone log using MENUITEM_PHONELOG_VIEW field.
Offline  
Old 06-13-2008, 02:24 AM   #8
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

With firmware 4.5 you get some values from the menuitem - but not all. most important you do not get the result of a local addressbook search. no answer from rim support about this topic :(
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 06-25-2008, 10:11 AM   #9
lePin
New Member
 
Join Date: Jun 2008
Model: 7100T
PIN: N/A
Carrier: none
Posts: 13
Default

Quote:
Originally Posted by simon.hain View Post
With firmware 4.5 you get some values from the menuitem - but not all. most important you do not get the result of a local addressbook search. no answer from rim support about this topic :(
So, it seems to be fixed! I mean the issue with MENUITEM registration in the call log.
Though it still does not work as documented. Using MENUITEM_PHONELOG_VIEW still has no effect, but item registred by MENUITEM_PHONE sends a PhoneLog instance to the application. It seems like bug - because acording documentation it mustn't happen!
Thus it is not bug but feature!
(I've used JDE 4.5.0.7 with built-in simulators).

Last edited by lePin; 06-25-2008 at 10:23 AM..
Offline  
Old 06-25-2008, 10:21 AM   #10
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

nice to know, i'll test it soon.
have to correct myself, i tested it with 4.6beta and it did not work correctly.

do you also get the contact if you look up a contact in the phone application and call the menu on the result?
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 06-25-2008, 03:35 PM   #11
lePin
New Member
 
Join Date: Jun 2008
Model: 7100T
PIN: N/A
Carrier: none
Posts: 13
Default

Quote:
Originally Posted by simon.hain View Post
nice to know, i'll test it soon.
have to correct myself, i tested it with 4.6beta and it did not work correctly.

do you also get the contact if you look up a contact in the phone application and call the menu on the result?
What do you mean?
I have a contact when I pick out any line in the phone list (it does not matter, when the call was). But I have two interesting notes:
1. When I make a call to a phone number, then I add this number to the address book and after that I choose this line from the log - I receive the contact without Name, the Number only. Name is null. ))
2. If I change the Phone List View in the General Phone Options to any view type except Call Log the instance will equal to null.

Pavel

Last edited by lePin; 06-25-2008 at 03:37 PM..
Offline  
Old 06-27-2008, 03:42 AM   #12
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

i tested the issue using 4.5

when i enter a number i get a string as a context object (correct)
when i navigate on the call log i get a PhoneCallLog object (correct - was not working prior)
when i look up a name i get null as a context object (still not working)


the only thing the native phone application does better is looking up names, the API for this is unusably slow if there are more contacts in the addressbook. too bad you still can not use the native app via a menu entry :(
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 07-02-2008, 10:33 PM   #13
samwize
New Member
 
Join Date: Apr 2008
Model: none
PIN: N/A
Carrier: starhub
Posts: 11
Default

Quote:
Originally Posted by lePin View Post
So, it seems to be fixed! I mean the issue with MENUITEM registration in the call log.
Though it still does not work as documented. Using MENUITEM_PHONELOG_VIEW still has no effect, but item registred by MENUITEM_PHONE sends a PhoneLog instance to the application. It seems like bug - because acording documentation it mustn't happen!
Thus it is not bug but feature!
(I've used JDE 4.5.0.7 with built-in simulators).
I observed the same. I am curious why menu item registered by MENUITEM_PHONE sends a PhoneLog instance to the application.. Why does it not return the selected contact instead?? What a feature..
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16) picture

Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16)

$189.99



VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250 picture

VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250

$79.99



HSS 12pcs Valve Seat & Face Cutter 45dec 30dec 20dec for Vintage Car, Bikes ,Jee picture

HSS 12pcs Valve Seat & Face Cutter 45dec 30dec 20dec for Vintage Car, Bikes ,Jee

$235.94



Niedermaier vintage Mannequins Visual Display Props Dec. 1991 Catalogue picture

Niedermaier vintage Mannequins Visual Display Props Dec. 1991 Catalogue

$141.00



Sketchy Chics - June 2021 - December 2022. Vintage Collection Art picture

Sketchy Chics - June 2021 - December 2022. Vintage Collection Art

$22.50



Adec Vintage Adjusting Dentist Doctor Medical Stool Rolling Swivel Chair picture

Adec Vintage Adjusting Dentist Doctor Medical Stool Rolling Swivel Chair

$199.99







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