Join Our 3 MILLION+ Members Today! Register Here | Login
Go Back   BlackBerry Forums at CrackBerry.com > BlackBerry Professionals > App Developers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
    Thread Author   #1  
Old 01-07-2011, 12:25 PM
CrackBerry User
 
Join Date: May 2010
Posts: 22
Likes Received: 0
Thanked 0 Times in 0 Posts
Default PIMList.choose() hanging & Blackberry simulator spontaneous restart

I just sat down to continue my development efforts after a pause before which I had committed some work to Subversion via Subclipse. I started Eclipse and the first thing I did was to run the simulator, just to get caught up and remind myself where I'd left off, running it through the exact same sequence (supposedly) as when I left off before Christmas. This time when I ran it, though, I started having two very odd problems, one of which is extremely annoying and the other of which is a development show-stopper:

The simulator keeps spontaneously starting without me telling it to debug or run, the only necessary condition apparently is having Eclipse open and the edit window on my desktop. If it is minimized in the task bar, this doesn't seem to happen. It may start two or three instantiations of the simulator, and it is not "connected" with Eclipse in the debug sense (i. e., the little squiggly doohickey marked "Disconnect" in Debug Perspective is grayed out and no startup messages appear in the console window). I have to start the task manager and kill whatever fledge and BbDevMgr processes are running to get rid of these extraneous, out-of-nowhere simulator startups.

OK, that's annoying, but the show-stopper is this code snippet:
Code:
public boolean getFromUser()
    {
    System.out.println("NativeContact::getFromUser() trying...");
    try
        {
        // Should we do this in RoloContact, since that's where we're trying to isolate native code?
        System.out.println("NativeContact::getFromUser() calling choose()...");
        PIMItem pim_con= ((BlackBerryContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE)).choose();
        System.out.println("NativeContact::getFromUser() returned");
        if(pim_con instanceof Contact)
            {
            System.out.println("NativeContact::getFromUser got instanceof Contact; pim_con= " + pim_con.toString());
            contact= (BlackBerryContact) pim_con;
            System.out.println("NativeContact::returning");
            return true;
            }
        }
    catch (PIMException e)
        {
        // TODO Auto-generated catch block
        System.out.println("NativeContact::getFromUser: " + e.toString());
        e.printStackTrace();
        return false;
        }
    return false;
    }
Except for the one in the catch clause, all the System.out.println's have been added since I've been fooling with this. The last time I ran this before Christmas it worked fine. When this function returned, I just popped up a dialog in the calling program that said "OK, here we are", waited for a click on the "OK" button, and exited. Now, when it executes the line with choose() in it, the Blackberry screen comes up just as expected. I can add or edit a contact, but it just hangs within the contact-choose screen; i. e., it won't just select and return to my program, but the contact app appears to continue to function.

These seem like two unrelated problems, and I debated two separate posts, but they "all of a sudden" started happening at exactly the same time, and I am just not that much of a believer in coincidence (having said that, I'm certainly open to other opinions).

Some additional information: I've tried to do a software update, and was informed that all the software was up-to-date; I've "cleaned" the simulator (as in "Project->Blackberry->Clean Simulator"), whatever that means, and also did a clean on the project, which in most cases seems to have magical restorative properties, but not this time. Also, the behavior is the same in the 8300 and the 8830 simulators. I'm developing on OS version 4.5.

And, yes, I do know that in the computer world things don't just "all of a sudden" happen, but I can't think of anything I did over the past month that could have caused this. The last major mod I made to the IDE was to add the Subversion Subclipse plugin, but I used the system for at least a couple of weeks and, except for the incredibly touchy, delicate nature of Subversion CM (more the subject of a rant than a forum post;-), there seemed to be no problems. I am going to backtrack that and continue to play around with this, but I'm hoping that in the meantime someone may have some insight.

TIA...
Allen
Reply With Quote Tip this Post
    Thread Author   #2  
Old 01-08-2011, 08:36 AM
CrackBerry User
 
Join Date: May 2010
Posts: 22
Likes Received: 0
Thanked 0 Times in 0 Posts
Default

Hello? Anyone home?

Since posting, I've broken the choose() call into individual statements & variables, downloaded three brand new, untarnished simulators, and still no joy; just goes into the address book, wihch seems fine adding & editing contacts, etc., but never comes out. Here's a partial stack trace of the app when in the address book:
Quote:
Object.wait() line: 480
SlickSwitch(Application).startModalEventThread(Mod alEventThread) line: 2255
UiEngineImpl.pushModalScreen(Screen) line: 979
SlickSwitch(UiApplication).pushModalScreen(Screen) line: 308
AddressSelectionVerb.invoke(Object) line: 120
ContactListImpl$ChooseContactRunnable.run() line: 966
SlickSwitch(Application).invokeAndWait(Runnable) line: 2147
ContactListImpl.choose() line: 944
RoloContact$NativeContact.getFromUser() line: 533
RoloContact$NativeContact.<init>(RoloContact) line: 508
RoloContact.<init>(boolean) line: 85
Rolodex.select() line: 138
SlickInit.yesPressed() line: 83
SlickScreens$InitScreens$Query2Initialize(UtilScre ens$HelpDlg).fieldChanged(Field, int) line: 137
BitmapButton(Field).fieldChangeNotify(int) line: 1405
BitmapButton(UIButton).navigationClick(int, int) line: 263
HorizontalFieldManager(Manager).navigationClick(in t, int) line: 3081
UIScreen$2(Manager).navigationClick(int, int) line: 3081
Evidently, the object (my application object?) is never getting notified.

Does anyone out there have any ideas?? Is there anyone out there?
Reply With Quote Tip this Post
  #3  
Old 01-08-2011, 06:40 PM
CrackBerry Genius
Device(s): 9810 (Torch)
Carrier: Telus
 
Location: Dartmouth, Nova Scotia
Join Date: Dec 2008
Posts: 2,671
Likes Received: 35
Thanked 71 Times in 65 Posts
Default

I'm kind of curious here. In your try/catch statement you have a return false statement in the catch. But there is no return true statement in the routine. Am I reading this correct?
__________________
9800(retired)
9810 running 7.1.0.284
Reply With Quote Tip this Post
    Thread Author   #4  
Old 01-29-2011, 11:50 AM
CrackBerry User
 
Join Date: May 2010
Posts: 22
Likes Received: 0
Thanked 0 Times in 0 Posts
Default

Sorry about the delay. I never got an email that someone responded. I'm still having this problem after a hiatus doing a system upgrade.

No, that's not quite right. Notice that if the return from choose() is an "instanceof" Contact, it returns true; the only other two options are that an exception is thrown, in which case false is returned, or that the return is NOT an "instanceof" Contact, in which case the code falls through the try/catch block and false is also returned.

Note that my problem is not an erroneous return, but that the choose() call (PIMList method) never returns.

Last edited by anw1652; 01-29-2011 at 11:56 AM. Reason: Clarify Problem (last sentence added)
Reply With Quote Tip this Post
  #5  
Old 01-29-2011, 09:53 PM
CrackBerry Addict
 
Join Date: Dec 2010
Posts: 870
Likes Received: 38
Thanked 69 Times in 63 Posts
Default

I developed an application (EveryLock) that uses the popup contact list chooser and I've had ONE person tell me that when he selects something, it just hangs. However, I cannot reproduce the problem no matter what happens. Have you tried it on other OS? It works fine for me on OS 5 and OS 6. Btw, you shouldn't develop for OS 4.5 anymore. It will be completely dead soon. Probably within another year. You should do 4.6 and up.

This is my code and it works fine on every phone I have.

PIM pim = PIM.getInstance();
BlackBerryContactList contacts;
try {
contacts = (BlackBerryContactList)pim.openPIMList(PIM.CONTACT _LIST, PIM.READ_WRITE);
PIMItem selected = contacts.choose();
__________________
Currently Developed Apps:

EveryLock,Tapatalk

Last edited by EveryApp Mobile; 01-29-2011 at 09:56 PM.
Reply With Quote Tip this Post
    Thread Author   #6  
Old 01-30-2011, 12:21 PM
CrackBerry User
 
Join Date: May 2010
Posts: 22
Likes Received: 0
Thanked 0 Times in 0 Posts
Default

I think I'll take your advice about using 4.6 and up, but this was working on 4.5 and I've also tested it on the 9000/OS 4.6 (I think) simulator.

I have just done a virgin (re)install with no Subclipse. I can't imagine that being an issue, but I figure I'll try everything because I'm sure any BB help will be predicated on a 100% supported environment.
Reply With Quote Tip this Post
Reply
BlackBerry Forums at CrackBerry.com > > BlackBerry Professionals > App Developers   PIMList.choose() hanging & Blackberry simulator spontaneous restart

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes