View Single Post
Old 09-17-2009, 07:01 AM   #14
sonia1986
Knows Where the Search Button Is
 
Join Date: Jun 2009
Model: 7110
PIN: N/A
Carrier: engg.
Posts: 19
Default

Quote:
Originally Posted by sonia1986 View Post
Hello
Thanks alot...its worked out.
Now i am able to open address book.
There is one more question in menu of Blackberry native address book can i append the name of my application and invoke my application from the native address book...Is it possible?If yes then How?
Hello i get a solution this 2 but unable to call my app through that app
This is class which append the menu in native address book.
Code:
package device.pim;

import net.rim.blackberry.api.menuitem.ApplicationMenuItem;
import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;
import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.ui.component.*; 
import net.rim.device.api.system.*;
import net.rim.device.api.ui.component.Dialog.*;


public final class MenuTest extends Application {
    private static long ID = 0x7cab1e23b72a0033L; 
    
    public static void main(String[] args) {
        MenuTest app = new MenuTest();
        app.enterEventDispatcher();
    }
    
    MenuTest() {
         System.out.println("Registering MenuTest");
         long locationToAddMenuItem = ApplicationMenuItemRepository.MENUITEM_ADDRESSBOOK_LIST ;
         ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();
         ApplicationMenuItem imagemenu = new DemoMenuItem();
         ApplicationDescriptor app = ApplicationDescriptor.currentApplicationDescriptor();
         amir.addMenuItem(locationToAddMenuItem , imagemenu, app);

    }
   
    private static class DemoMenuItem extends ApplicationMenuItem {
        DemoMenuItem() {
            super(20);
        }
        
        public String toString() {
            return "Send ABC SMS";
        }
        
 public Object run(Object context) {

        if (context instanceof String) {
          //  new PIMDemo().enterEventDispatcher();
            return context;
            } 
    return context;
  }
}
}

Code:
/*
This is my app which i want call from upper class..
package device.pim;
import net.rim.device.api.ui.*;

public final class PIMDemo extends UiApplication
{    
    private EventScreen _eventScreen;
   
   // Entry point for application
    public static void main(String[] args)
    {
        new PIMDemo().enterEventDispatcher();
    }    
    
    // Constructor
    private PIMDemo()
    {   
        // Create a new EventScreen and push screen onto stack.
        _eventScreen = new EventScreen();        
        pushScreen(_eventScreen); 
        //new ContactsDemo().enterEventDispatcher();
    }
}
Thanks in advance..plzz reply soon
Offline   Reply With Quote