Note that there are some explanatory texts on larger screens.

plurals
  1. POcreateBitmap --- java.lang.IllegalArgumentException: x must be < bitmap.width()
    primarykey
    data
    text
    <p>I am getting error while taking screenshot and create bitmap with cropping picture</p> <p>below is my code</p> <pre><code> View v1 = mKittyBGLayer.getRootView(); v1.setDrawingCacheEnabled(true); Bitmap source = v1.getDrawingCache(); int width = source.getWidth(); int height = source.getHeight(); System.out.println("vListView : -"+vListView.getWidth()); System.out.println("hListView : -"+hListView.getHeight()); System.out.println("Width : -"+width); System.out.println("Height : -"+height); bitmap = Bitmap.createBitmap(source, vListView.getWidth(), 0, width, height - hListView.getHeight()); </code></pre> <p>my logcat is</p> <pre><code> 11-01 11:00:31.419: I/System.out(1658): vListView :- 60 11-01 11:00:31.429: I/System.out(1658): hListView :- 60 11-01 11:00:31.429: I/System.out(1658): Width :- 480 11-01 11:00:31.429: I/System.out(1658): Height :- 320 11-01 11:00:31.429: D/AndroidRuntime(1658): Shutting down VM 11-01 11:00:31.429: W/dalvikvm(1658): threadid=1: thread exiting with uncaught exception (group=0x40018560) 11-01 11:00:31.429: E/AndroidRuntime(1658): FATAL EXCEPTION: main 11-01 11:00:31.429: E/AndroidRuntime(1658): java.lang.IllegalArgumentException: x + width must be &lt;= bitmap.width() 11-01 11:00:31.429: E/AndroidRuntime(1658): at android.graphics.Bitmap.createBitmap(Bitmap.java:410) 11-01 11:00:31.429: E/AndroidRuntime(1658): at android.graphics.Bitmap.createBitmap(Bitmap.java:383) 11-01 11:00:31.429: E/AndroidRuntime(1658): at com.appsehs.android.CUTECRAZYKITTENDRESSUPGAME.PhotoSortrActivity.takeScreenShot(PhotoSortrActivity.java:247) 11-01 11:00:31.429: E/AndroidRuntime(1658): at com.appsehs.android.CUTECRAZYKITTENDRESSUPGAME.PhotoSortrActivity.onOptionsItemSelected(PhotoSortrActivity.java:274) 11-01 11:00:31.429: E/AndroidRuntime(1658): at android.app.Activity.onMenuItemSelected(Activity.java:2205) </code></pre> <p>Here you can see that x &lt; bitmap.getWidth mean 60 &lt; 480 </p> <p>although i am getting error</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload