I have an app that uses a a paint flag to set strike-through on a TextView. This application works fine on the emulator until I enable GPU Rendering on the Android 4.03 AVD.
http://developer.android.com/tools/devices/emulator.html#acceleration
Once this is enabled, the entire emulator locks up and no longer responds the moment I set the paint flag.
TextView message = (TextView)v.findViewById(R.id.message);
message.setPaintFlags(day.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
This is inside of a ListView adapter and on load, it calls the getView(…) method and hits the setPaintFlags(…) method 6 times and crashes after the 6th time.
If I comment out the setPaintFlags(…) line, it doesn’t crash. If I install this on the phone, the app crashes once I trigger the strike-through to occur.
I’ve set this on the manifest solves the issue on the emulator, but still crashes on the phone.
<application android:hardwareAccelerated="false">
Does anyone have experience with this crashing on the phone, but not the emulator (unless it’s hardware accelerated).
I’ve dug around and found other similar postings Android emulator crashes; "emulator-arm.exe stopped responding" but in my case, it crashes on the phone too.
Solution Turned out to be a coincidence and was unrelated to the acceleration. Null pointer found via LogCat.
As per comments above:
Since the emulator is fine, and it’s the phone device crashing, use USB debugging to get the LogCat output. This will help to narrow down the cause of the crash/error.