ByoxCode / DrawView

Android view that allows the user to create drawings. Customize settings like color, width or tools. Undo or redo actions. Zoom into DrawView and add a background.
848 stars 155 forks source link

java.lang.IllegalArgumentException: width and height must be > 0 #34

Open vyasishanatc194 opened 4 years ago

vyasishanatc194 commented 4 years ago
    Bitmap init = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
    mZoomOverlay = init.copy(Bitmap.Config.ARGB_8888, true);
    init.recycle();
    mCanvasOverlay = new Canvas(mZoomOverlay);

    invalidate();

Android Version 10 compileSdkVersion 28 minSdkVersion 14 targetSdkVersion 28 versionCode 14 versionName "1.3.1"

verinder84 commented 4 years ago

call like this or wait to start app

new Handler().postDelayed(new Runnable() { @Override public void run() { Bitmap icon = BitmapFactory.decodeResource(getResources(),R.drawable.mypic); mDrawView.setBackgroundImage(icon, BackgroundType.BITMAP, BackgroundScale.CENTER_INSIDE); } }, 1000);

salario07 commented 3 years ago

thanks to byox great project, I cloned the project and fixed this bug. feel free to use it. implementation 'com.github.salario07:DrawView:1.0.4'

also see latest version from here: https://jitpack.io/#salario07/DrawView

sufwankhalid commented 3 years ago
    Bitmap init = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
    mZoomOverlay = init.copy(Bitmap.Config.ARGB_8888, true);
    init.recycle();
    mCanvasOverlay = new Canvas(mZoomOverlay);

    invalidate();

Android Version 10 compileSdkVersion 28 minSdkVersion 14 targetSdkVersion 28 versionCode 14 versionName "1.3.1"

having same issue when zoom is enabled