04-20-2010 12:07 PM
Is there any way to set the addressbook user fields in such a way that they're treated as phone numbers?.
I'll explain myself: what we'd like to achieve is to rename a user custom field to a name of our convenience, and to store a phone number there. This way, the number (together with the name of our convenience) could appear in "Call which number?" dialog, for instance.
We found in other threads that this could be wrapped around using the "Other" phone number field, but such a field can not be renamed, so we're kind of stuck in there.
Another question (but more or less on the same topic) might be: is there a way to add buttons to "Call which number?" dialog?... That might do the trick, although there's only trying to find "uglier" solutions for the base problem.
Thanks in advance.
04-23-2010 03:02 PM
As you have found out you can customize the name of the custom user fields, however you cannot change their behaviour (such as having them used in the "Call which number" dialog.
You could add a custom ApplicationMenuItem to the Address Book application that dials the number in that field. It'll give the user an easier way to dial using that number. But that means they'll need to use your menu item instead of just pressing the Green call button.
04-27-2010 09:54 AM
Thank you for your answer, Mark; I was afraid it was going to be that way. I'm trying to find a solution as user-friendly and integrated with the BB applications/menus as possible, and I have a couple of questions...
Concerning the soultion you purpose, i.e. adding a custom ApplicationMenuItem, I have to say I could consider it a valid alternative. I have been surfing the documentation and I think that what best suites what I'm looking for is...
ApplicationMenuItemRepository.addMenuItem( MENUITEM_ADDRESSCARD_VIEW, myMenuItem )
The problem that I found when I implemented this solution is that I don't feel I can control the order where myMenuItem appears. I tried different values to MenuItem constructor, with the same result: myMenuOption appears as the first menuitem within the menu. Is this normal? How could I alter the menuitem position?
Another thing I'd like to get along with is the MenuItem context awareness, since if the contact that is being presented hasn't filled up the custom user field I want to rename, the custom menu item shouldn't appear in the menu either. Is this feasible?
Finally, I'm searching the forum for a solution to the problem: "injecting a button to a dialog". What I'm trying to achieve is to, somehow, add a button to "Call which number?" dialog with my custom user field number. I was wondering if this could be done listening to the green key when Address book application is running... As I solution I don't find it very elegant... but if there's nothing better this could work, couldn't it?
Do I have chances to succeed in this workaround I thoguht of? Any other ideas/alternatives on the subject?
Thanks in advance.
04-27-2010 09:57 AM
you cannot control the position of the custom menu item
the custom menu item is not context-sensitive
you cannot inject a button into a dialog that you cannot access. popupscreens are not accessible using the API.
04-28-2010 09:12 AM
Hello simon_hain, and thank you for your quick answer... a bit discouraging to discover my workaround can not be done, though... but I guess it's just another happy day as a BB programmer!!!
Has anyone any other ideas to achieve what I'm going after (make the user believe that user custom field stores a phone number), or am I just wasting my time here? (I'm not that far from the next project deadline!!!)
Thanks in advance
04-28-2010 09:26 AM
unless you work with the contact yourself: i don't think so. no chance to use one of the plenty phone number fields a blackberry contract provides?
04-29-2010 02:39 AM
I really wish I could.... it's not a question of having enough phone numbers... it's just a question of user-friendliness and how little the names of such native BB phone numbers suite what the custom user phone number itself will mean.
Anyway, thank you very much for your help... and if I'd figure out a workaround on this (as difficult as it seems by now) I promise I will post it here.
Just a tiny question more: if I add a menuitem to the addresscard_view menu, when the user presses on such a menuitem and consequently BB invokes the "run" method of it... do I get a reference to the current contact as the method's context?. Otherwise, what would be the context in that case (if any)?. What if I added to the Addressbook menu instead?.
Thanks in advance.
04-29-2010 03:01 AM
I just found a way to figure it out myself, doing this:
public Object run( Object aContext )
String aClassType = aContext.getClass().toString();
System.out.println( aClassType );
For a menuitem added to addresscard_view, I get "class net.rim.blackberry.api.pdap.ContactImpl" ... and if I surf the API, the package net.rim.blackberry.api.pdap contains several interfaces, and BlackBerryContact is among them... next thing I tried, is
if (aContext instanceof BlackBerryContact) and the magic was done...
I haven't tried yet with addressbook_list menus, but I just wanted to give the clue if anyone comes up with this same question.