Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
BlueBerry1988
Posts: 157
Registered: 03-03-2009

CodeModuleGroupManager.loadAll() returns null

I am using JDE 4.7 and its default simulator. I have a few apps installed but when making a call from on app

 

CodeModuleGroupManager.loadAll()

 

it returns null. I also tried

 

String moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName();

CodeModuleGroupManager.load(moduleName);

 

it also returns null.

 

Any thoughts on what could be wrong here? Thanks

 

 

Please use plain text.
Developer
Posts: 432
Registered: 02-23-2009

Re: CodeModuleGroupManager.loadAll() returns null

CodeModuleGroupManager.loadAll() returns null if there is if no list of groups available, or list of available groups has no members. Please confirm is there aby group there or not?

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

 

 

Deepesh Gupta
Please use plain text.
Developer
amardeepjaiman
Posts: 286
Registered: 02-25-2009

Re: CodeModuleGroupManager.loadAll() returns null

First make sure

 

CodeModuleGroupManager.getNumberOfGroups() method is not returning 0. if it is returning zero then there is no group avilable for the perticular application module or all application modules.

Please use plain text.
Developer
BlueBerry1988
Posts: 157
Registered: 03-03-2009

Re: CodeModuleGroupManager.loadAll() returns null

CodeModuleGroupManager.getNumberOfGroups() does return 0.

 

Here comes the dumb question - what is a group?  I thought every app installed is a group..

 

I try to follow 

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800708/800646/How_To_...

 

to get a few attributes out of an app's JAD file. But so far it does not work...

Please use plain text.
Developer
Posts: 432
Registered: 02-23-2009

Re: CodeModuleGroupManager.loadAll() returns null

No, Every app which is on device(installed) is not an group but group is a groupname for a type of applications. you can specify a group name for a app.

 

If you need to get info for a particular app then use CodeModuleManager class. Using this you can createNewModule(), getModuleName(), getModuleHandle(), module version, module url etc.

 

 

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

 

Deepesh Gupta
Please use plain text.
Developer
BlueBerry1988
Posts: 157
Registered: 03-03-2009

Re: CodeModuleGroupManager.loadAll() returns null

I want to get a few properties I created in the JAD file following the "how to" guide in knowledge base (link provided above)

 

here is the codes they provided:

 

CodeModuleGroup[] allGroups = CodeModuleGroupManager.loadAll();
CodeModuleGroup myGroup = null;
String moduleName = ApplicationDescriptor
   .currentApplicationDescriptor().getModuleName();

for (int i = 0; i < allGroups.length; i++) {
   if (allGroups[i].containsModule(moduleName)) {
      myGroup = allGroups[i];
      break;
    }
}

// Get the property
String description = myGroup.getProperty("MIDlet-Description");
String custom = myGroup.getProperty("My-Custom-JAD-Property");

 

 

 

 

So I am puzzeled what extra step I need to do in order to make it work?

Please use plain text.
Developer
amardeepjaiman
Posts: 286
Registered: 02-25-2009

Re: CodeModuleGroupManager.loadAll() returns null

Hi,

 

if you want to get the value of ordinary properties supported in Jad. Then Use the fowllowing code : 

 

 CodeModuleGroup cmg = CodeModuleGroupManager.load(group_name); 
for( Enumeration e = cmg.getPropertyNames(); e.hasMoreElements(); )
{
String name = (String)e.nextElement();
System.out.println( "Name: " + name );
System.out.println( "Value: " + cmg.getProperty(name) );
}

 

 

If you have made some custom entries in jad, and you want to access them , then 

 

value = cmg.getProperty("custome property name");

will give you the value of custom property.

Please use plain text.
Developer
BlueBerry1988
Posts: 157
Registered: 03-03-2009

Re: CodeModuleGroupManager.loadAll() returns null

Unfortunately in my case, CodeModuleGroupManager.load(moduleName) returns null.

 

where moduleName is obtained via

 

String moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName();

 

Does this work only when one installs the app on phone over the air? Or should it work in JDE/simulator as well?

Please use plain text.
Developer
amardeepjaiman
Posts: 286
Registered: 02-25-2009

Re: CodeModuleGroupManager.loadAll() returns null

CodeModuleManager.getModuleHandles() returns a list of handles for every COD file on the device. Are you testing it ondevice?
Please use plain text.
Developer
BlueBerry1988
Posts: 157
Registered: 03-03-2009

Re: CodeModuleGroupManager.loadAll() returns null

I am testing on JDE 4.7
Please use plain text.