-1

我想要与黑莓中的 jad 文件相关的所有信息。我应该如何获得它?

4

1 回答 1

1

试试下面的代码请注意

这是仅在设备上工作,不在模拟器上测试

import java.util.Enumeration;

import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.system.CodeModuleGroup;
import net.rim.device.api.system.CodeModuleGroupManager;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;

public class StartUp extends UiApplication{
    public static void main(String[] args) {
        StartUp up=new StartUp();
        up.enterEventDispatcher();
    }
    public StartUp()
    {
        MainScreen screen=new MainScreen();
         CodeModuleGroup cmg = null;
            CodeModuleGroup[] allGroups = CodeModuleGroupManager.loadAll();
            String moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName();
            for (int i = 0; i < allGroups.length; i++) {
               if (allGroups[i].containsModule(moduleName)) {
                   cmg = allGroups[i];
                  break;
                 }
            }
            if (cmg == null) {
                screen.add(new LabelField("not able to fetch properties"));
            } else {
                double size=0;
                for (Enumeration e = cmg.getPropertyNames(); e
                        .hasMoreElements();) {
                    String name = (String) e.nextElement();
                    String value = cmg.getProperty(name);
                    System.out.println(name+" : "+value);
                    screen.add(new LabelField(name+" : "+value,Field.FOCUSABLE));
                }
            }
        UiApplication.getUiApplication().pushScreen(screen);

    }

}
于 2012-04-09T10:19:15.070 回答