如何找到黑莓编程运行的应用程序的大小? [英] How to find running application size programatically in blackberry?

查看:87
本文介绍了如何找到黑莓编程运行的应用程序的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到$运行BlackBerry应用C $ C.I检查<一的大小href=\"http://stackoverflow.com/questions/7845088/how-to-find-application-size-in-blackberry-by-$c$c\">how由code找到黑莓应用程序的大小?的链接,但我没有得到答案。请给我建议的解决方案。先谢谢了。

i want to find the size of running application of blackberry by code.I checked the how to find application size in blackberry by code? link but i am not getting answer. Please suggest me solution. Thanks in advance.

推荐答案

如果你的意思是运行的应用程序的大小的总cod文件的大小
那么我们就可以计算了。

If you mean of size of running application that size of total cod files then we can calculate.

当我们使用JAD安装装配应用,我们可以看到应用程序的大小。

when we instal application using JAD we can see the application size.

例如:我的应用程序名称为 PictureBackground

For example: my application name is PictureBackground

成功登录应用程序我们可以采取鳕鱼费尔和色器件安装jad文件之后。当我们点击PictureBackground.jad那么,我们可以发现以下类型的信息

After successful sign in application we can take cod fils and jad file for devise installation. when we click on PictureBackground.jad then we can find following type of information

名称: PictureBackground

Name: PictureBackground

版本: 1.0.0

销售者:黑莓开发者

面积: 513.4kb

如果您希望以务实的态度检索大小,那么我们可以做到这一点如下

If you want to pragmatically retrieve that size, then we can do it as following

我们可以找到更多的应用在PictureBackground.jad文件中的所有信息。

we can find all information about application in PictureBackground.jad file

例如PictureBackground.jad文件如下:

For example PictureBackground.jad file as follow:

RIM-COD-SHA1-4: ff 3c 2f ec 7b 6a 3d 1a e3 86 ec d2 87 0a c3 e1 6c f3 14 0e
RIM-COD-SHA1-3: 07 4d f7 db 9a f3 df 1d 00 90 b6 4f 54 f0 3a f0 c8 de ca b1
RIM-COD-SHA1-2: 95 14 4a 6a 7d 3a 1b db 2e 0f 05 b8 e1 ff 66 8a e0 ce f1 64
RIM-COD-SHA1-1: 68 a7 09 4e dc cf 2f c1 9b 43 d1 0b 35 b8 4b bc 35 72 ba 92
RIM-MIDlet-Flags-1: 0
MIDlet-Jar-Size: 591513
MIDlet-Name: PictureBackground
MIDlet-Jar-URL: PictureBackground.jar
MicroEdition-Configuration: CLDC-1.1
RIM-COD-URL-9: PictureBackground-9.cod
RIM-COD-URL-8: PictureBackground-8.cod
RIM-COD-URL-7: PictureBackground-7.cod
RIM-COD-Module-Dependencies: net_rim_cldc
RIM-COD-URL-6: PictureBackground-6.cod
RIM-COD-URL-5: PictureBackground-5.cod
RIM-COD-URL-4: PictureBackground-4.cod
RIM-COD-URL-3: PictureBackground-3.cod
RIM-COD-URL-2: PictureBackground-2.cod
RIM-COD-URL-1: PictureBackground-1.cod
RIM-COD-Size-9: 51288
RIM-COD-Size-8: 55284
RIM-COD-Size-7: 58560
RIM-COD-Size-6: 51340
RIM-COD-Size-5: 55748
RIM-COD-Size-4: 53000
RIM-COD-Size-3: 55084
RIM-COD-Module-Name: PictureBackground
RIM-COD-Size-2: 51284
RIM-COD-Size-1: 60448
RIM-COD-SHA1: 55 82 db c2 8c 44 73 c8 44 b6 ce 7f 20 bb 70 47 d2 df fe ab
RIM-COD-Size: 33688
MicroEdition-Profile: MIDP-2.0
MIDlet-Vendor: BlackBerry Developer
MIDlet-1: PictureBackground,,
RIM-COD-URL: PictureBackground.cod
Manifest-Version: 1.0
MIDlet-Version: 1.0.0
RIM-COD-SHA1-9: 76 04 75 59 21 27 c6 18 97 ed 49 fb ce 03 f3 21 fd 63 c1 96
RIM-COD-SHA1-8: 79 a9 b7 85 59 aa 06 e6 4b 76 89 de 12 cd 10 0d 54 93 48 dd
RIM-COD-SHA1-7: 3d d1 d1 47 e3 8d b5 9d 57 89 51 e3 a9 b3 77 5e c4 57 17 a8
RIM-COD-Creation-Time: 1327931490
RIM-COD-SHA1-6: f7 78 f7 b3 46 f5 69 91 9d 87 33 d0 a9 9d 9b 92 b6 de 90 74
RIM-COD-SHA1-5: 98 b3 45 64 8b 5f 36 0a aa c1 0e 2e 66 ea 7a f7 50 37 05 7a

通过这个我们可以发现运行的应用程序的大小
 样品code:

 package samplecode;

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.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);

                    if(name.indexOf("RIM-COD-Size")!=-1)
                    {
                        size=size+Double.parseDouble(value);
                    }
                    //add(new LabelField("Name: " + name));

                }
                screen.add(new LabelField("Size: " +(size/1024)+"kb"));
            }
        UiApplication.getUiApplication().pushScreen(screen);

    }

}

注意:它不会工作模拟器上,它适用于设计(应该安装从JAD文件),我们可以发现OUTPUT如下

size:513.40234375KB

这篇关于如何找到黑莓编程运行的应用程序的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆