【发布时间】:2014-07-25 23:52:27
【问题描述】:
有人知道如何解决这个错误吗?构造函数 StarBitmap(Bitmap, boolean, int) 不可见。它发生在这段代码的第二行:
Bitmap bm = BitmapFactory.decodeResource(context.getResources(), R.drawable.euro_cert_black);
StarBitmap starbitmap = new StarBitmap(bm, false, 408);
我不知道如何解决这个问题。 我检查了是否有 StarBitmap 的导入并且有。 尝试从我找到的一些答案中将其更改为 getResource() 但仍然没有。 我尝试将 public 添加到 StarBitmap 构造函数,但仍然没有。
我有这个代码的班级是public class Print{}
StarBitmap 和构造函数是这样的:
public class StarBitmap
{
int[] pixels;
int height;
int width;
boolean dithering;
byte[] imageData;
public StarBitmap(Bitmap picture, boolean supportDithering, int maxWidth)
{
if(picture.getWidth() > maxWidth)
{
ScallImage(picture, maxWidth);
}
else
{
height = picture.getHeight();
width = picture.getWidth();
pixels = new int[height * width];
for(int y=0;y < height; y++)
{
for(int x=0;x<width; x++)
{
pixels[PixelIndex(x,y)] = picture.getPixel(x, y);
}
}
//picture.getPixels(pixels, 0, width, 0, 0, width, height);
}
dithering = supportDithering;
imageData = null;
}
顺便说一下,StarBitmap 来自 Star Micronics 便携式打印机的 sdk
【问题讨论】:
-
在
StarBitmap构造函数之前添加public -
我试过了。依然没有。顺便说一下,StarBitmap 来自 Star Micronics 便携式打印机的 sdk
-
现在请将该公开添加到您发布的代码中。
-
我做到了。但这仍然不能解决我的问题
-
实际上它正在工作。该项目需要一个干净的-.-
标签: android printing stario-sdk