display image from byteArray

前端 未结 2 983
野趣味
野趣味 2020-12-14 08:26

I have a Main class with has onCreate() method. in that method i have made the MapFile class\' object.and called its readFile() and

2条回答
  •  醉酒成梦
    2020-12-14 08:45

    adding a byte array to an android imageview:

            //byte[] chartData 
            ImageView imgViewer = (ImageView) findViewById(R.id.chart_image);
            Bitmap bm = BitmapFactory.decodeByteArray(chartData, 0, chartData.length);
            DisplayMetrics dm = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(dm);
    
            imgViewer.setMinimumHeight(dm.heightPixels);
            imgViewer.setMinimumWidth(dm.widthPixels);
            imgViewer.setImageBitmap(bm);
    

提交回复
热议问题