Antonis Lambrianides
Antonis Lambrianides

Reputation: 220

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

Upvotes: 0

Views: 348

Answers (1)

Sripathi
Sripathi

Reputation: 1780

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

Upvotes: 2

Related Questions