Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image Blackberry Listfield带有实时图像_Image_Blackberry_Listfield - Fatal编程技术网

Image Blackberry Listfield带有实时图像

Image Blackberry Listfield带有实时图像,image,blackberry,listfield,Image,Blackberry,Listfield,我想在列表字段的所有行中显示一个包含实时图像的列表字段签出 还可以使用以下代码显示实时图像: public static String getImageFromUrl(String url) { //Image img = null; String imageData = null; try { imageData = getDataFromUrl(

我想在列表字段的所有行中显示一个包含实时图像的列表字段签出

还可以使用以下代码显示实时图像:

public static String getImageFromUrl(String url) {
            //Image img = null;
            String imageData = null;
            try
            {            
              imageData = getDataFromUrl(url);
              //img = Image.createImage(imageData.getBytes(), 0,imageData.length() );          
            }
            catch(Exception e1) {
                e1.printStackTrace();
            }

            return imageData;
        }

        public static String getDataFromUrl(String url) 
              throws IOException {

            StringBuffer b = new StringBuffer();
            InputStream is = null;
            HttpConnection c = null;

            long len = 0 ;
            int ch = 0;

            ConnectionFactory connFact = new ConnectionFactory();
              ConnectionDescriptor connDesc;
              connDesc = connFact.getConnection(url);

              if (connDesc != null)
              {
                  //HttpConnection httpConn;
                  c = (HttpConnection)connDesc.getConnection();
              }

           // c = (HttpConnection)Connector.open(url);
            is = c.openInputStream();
            len = c.getLength();
            if( len != -1) {
                // Read exactly Content-Length bytes
                for(int i =0 ; i < len ; i++ )
                    if((ch = is.read()) != -1) {
                    b.append((char) ch);
                    }
            } else {
                //Read until the connection is closed.
                while ((ch = is.read()) != -1) {
                    len = is.available() ;
                    b.append((char)ch);
                }
            }

            is.close();
            c.close();
            return b.toString();
        }  
公共静态字符串getImageFromUrl(字符串url){
//图像img=null;
字符串imageData=null;
尝试
{            
imageData=getDataFromUrl(url);
//img=Image.createImage(imageData.getBytes(),0,imageData.length());
}
捕获(异常e1){
e1.printStackTrace();
}
返回图像数据;
}
公共静态字符串getDataFromUrl(字符串url)
抛出IOException{
StringBuffer b=新的StringBuffer();
InputStream=null;
httpc=null;
长透镜=0;
int ch=0;
ConnectionFactory connFact=新的ConnectionFactory();
ConnectionDescriptor connDesc;
connDesc=connFact.getConnection(url);
如果(connDesc!=null)
{
//HttpConnection-httpConn;
c=(HttpConnection)connDesc.getConnection();
}
//c=(HttpConnection)Connector.open(url);
is=c.openInputStream();
len=c.getLength();
如果(len!=-1){
//准确读取内容长度字节
对于(int i=0;i

希望这对您有所帮助。

所有列表字段数据(包括实时图像URL)都来自web服务。我已成功传递了包括图像URL在内的所有数据。但我不知道如何显示每行中的每个图像。使用列表字段需要为每行编写绘制方法。我想你已经做了那部分了。油漆的图像部分会发生什么变化?你们能提供一个屏幕截图吗?每个数据都会在列表中成功管理。并解析iamge URL。在下载图片之前,我在每行设置了一个静态图片。但我不能替换下载图片。下载后请尝试
listfield.invalidate(imageIndex)
。我要试试这个。谢谢。我会试试这个。如果你接受答案,你应该点击右箭头。对不起,我不知道从哪里点击的?你知道BB设备应用程序正在BB Playbook上工作吗?