简体   繁体   中英

The constructor StarBitmap(Bitmap, boolean, int)is not visible

Anyone knows how to fix this error? The constructor StarBitmap(Bitmap, boolean, int)is not visible. it happens on the second line of this code:

Bitmap bm = BitmapFactory.decodeResource(context.getResources(), R.drawable.euro_cert_black);
        StarBitmap starbitmap = new StarBitmap(bm, false, 408);

I have no clue how to fix this. I checked if there is an import of StarBitmap and there is. Tried changing it to getResource() from some answers i found but still nothing. I tried adding public to StarBitmap constructor and still nothing.

The class i have this code in is public class Print{}

and the StarBitmap and consctuctor is something like this:

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;
    }

The StarBitmap by the way is from an sdk of Star Micronics portable printers

You have used the default visibility for the constructor starBitmap(). The default visibility enables the accessibility within the same package. But if you want to access the members across various packages it should be public. Refer the link for more info In Java, difference between default, public, protected, and private

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM