0

我是黑莓开发新手,是否可以获得安装在设备中的应用程序的包名称。我对此没有任何参考。

 int[] handle = codeModuleManager.getModuleHandles();                    
        for(int i=0; i<handle.length; i++){  
            ApplicationDescriptor[] app_descriptors = CodeModuleManager.getApplicationDescriptors(handle[i]);               
                if(app_descriptors != null){ 
                    System.out.println("app_descriptors length "+ app_descriptors.length);   
                    for(int j=0; j< app_descriptors.length; j++){
                        System.out.println("Iterating the arraylist :: "+ app_descriptors[j].toString());
                    } 
                }               
        }      
4

1 回答 1

1

Try this - This will get all the installed modules.

int[] v=net.rim.device.api.system.CodeModuleManager.getModuleHandles();

For getting the ApplicationDescriptors associated with the module, use the following code -

net.rim.device.api.system.CodeModuleManager.getApplicationDescriptors(int moduleHandle)

Edit : -

int[] handle = CodeModuleManager.getModuleHandles();                    
    for(int i=0; i<handle.length; i++){  
        ApplicationDescriptor[] app_descriptors = CodeModuleManager.getApplicationDescriptors(handle[i]);               
            if(app_descriptors != null){ 
                System.out.println("app_descriptors length "+ app_descriptors.length);   
                for(int j=0; j< app_descriptors.length; j++){
                     String moduleName = app_descriptors[i].getModuleName();
                     String name = app_descriptors[i].getName();


                } 
            }               
    }    
于 2012-08-07T10:03:44.460 回答