Home > Mobile >  Android8.0 system drawBitmap will become a card on your mobile phone
Android8.0 system drawBitmap will become a card on your mobile phone

Time:11-16

When doing the Android8.0 system adaptation recently discovered a problem, 8.0 system in drawBitmap on your mobile phone, exceed certain limit when the size of the Image (found the problem size is 512 * 256), and draw a lot (usually cycle), will become very card, a frame of two frames, if drawn only once, so frames is not too big change, basic didn't make much difference, but once in circulation, frames immediately down,

for (int I=0; i <4. + + I)
{
For (int j=0; J & lt; 5; + + j)
{

//packaging function, finally is drawBitmap (Bitmap Bitmap, float left, float top, Paint Paint)
Tools. DrawImage (g, imgTest, 10 * I, 10 * j);
}
}


Do you have a great god met? Or know is what circumstance, please discuss to solve! Only in mobile phones will be more than 8.0, the same code, 7.0 the following mobile phones running smoothly,

CodePudding user response:

You a log to see specific drew a few times, I feel more than 20 times

CodePudding user response:

Refer to https://issuetracker.google.com/issues/64882137
Seems to be a bug of android 8.0, can try to install the latest patches or upgrade to 8.1

CodePudding user response:

refer to the second floor jklwan response:
https://issuetracker.google.com/issues/64882137
Seems to be a bug of android 8.0, you can install the latest patch or upgrade to 8.1 try

If so, we can't ask all users to upgrade to 8.1 ah, still have to solve this problem from the code level is the best policy,

CodePudding user response:

reference 1st floor x443137254 response:
you a log to see specific drew a few times, I feel more than 20 times

Is not the problem, the number of actual application, sometimes need far more than 20 times a cycle, and you didn't notice the key, if is the number of questions, don't say no problem under 7.0, only 8.0 there is a problem, or exactly what has changed from 8.0 system,

CodePudding user response:

reference Moon0Light reply: 3/f
if it is so, we can't ask all users to upgrade to 8.1 ah, have to solve this problem from the code level is the best policy,

. Well, this I really can't, canvas drawbitmap finally is called system jni code, and see whether there is a great god will change

CodePudding user response:

Update problem, a new discovery: today is not the size of the image size problem, today found a size of 400 * 139 resources, there are three resources of the same size, one on the drawing, cycle number more cases will drop frames, I tried to reduce the cycle number, you can return to normal frame rate, but is only a test case, can control cycle number, this does not solve the fundamental problem, today to update the problem description, hope to have others to study this problem,

CodePudding user response:

Find the problem with 4.2 mobile map time 38 ms 8.0 to 150 ms or so difference is very big

CodePudding user response:

refer to the eighth floor s2221219 response:
find the problem with 4.2 mobile map time 38 ms 8.0 to 150 ms or so very different

Found so far is scaling time consuming, the greater the zoom the more time-consuming

CodePudding user response:

My old games also encounter this problem, must change! Everybody is there a way to solve?
My games draw the picture is more, so the card not line!

CodePudding user response:

In Android 2.3.3 (API level 10) and a lower case, reserve of bitmap pixel data to be stored in native memory, it is separated with bitmap itself, bitmap itself is stored in the Dalvik heap, native memory of pixel data not released in predictable ways, may cause the application briefly over its memory limit and collapse, from Android 3 (API level 11) to the Android 7.1 (API level 25), the pixel data is stored in a pile of Dalvik, as well as the associated bitmap, the Android 8 (26) API level and higher, the bitmap pixel data is stored in the native heap,


Don't know this useful no zoom, indeed, can reduce the frames, I zoom can also be set to 1 speed, 2 significantly more slowly!

CodePudding user response:

Already done!

CodePudding user response:

How to do!

CodePudding user response:

BitmapDrawable? Hardware acceleration?
  • Related