Could not lock surface

2019-06-17 07:23发布

问题:

I added an ActionBar to my app and now I am consistently running into this issue.

I am testing on a Galaxy S4. This issue causing the app to slow down and become unresponsive.

here is my code:

//Get action bar
actionBar = getActionBar();

//hide title to make room for spinner dropdown
actionBar.setDisplayShowTitleEnabled(false);

//set the mode
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
//spinner = (Spinner)findViewById(R.id.spinner);
quotetext = (TextView)findViewById(R.id.quote);       

ArrayList<SpinnerItem> values = SpinnerProducer.create();
//Set spinner adapter   
spinnerAdapter = new QuoteSpinnerAdapter(thisActivity,R.layout.spinner_row_layout,values);

actionBar.setListNavigationCallbacks(spinnerAdapter, new CustomOnItemSelectedListener());
actionBar.setSelectedNavigationItem(1);

Stacktrace:

08-11 18:59:51.776: E/Surface(17050): dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -2147483646
08-11 18:59:51.776: E/Surface(17050): dequeueBuffer failed (Unknown error 2147483646)
08-11 18:59:51.776: E/ViewRootImpl(17050): Could not lock surface
08-11 18:59:51.776: E/ViewRootImpl(17050): java.lang.IllegalArgumentException
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.Surface.nativeLockCanvas(Native Method)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.Surface.lockCanvas(Surface.java:253)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2760)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.ViewRootImpl.draw(ViewRootImpl.java:2734)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2572)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2144)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1235)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6472)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.Choreographer.doCallbacks(Choreographer.java:603)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.Choreographer.doFrame(Choreographer.java:573)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.os.Handler.handleCallback(Handler.java:733)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.os.Handler.dispatchMessage(Handler.java:95)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.os.Looper.loop(Looper.java:157)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at android.app.ActivityThread.main(ActivityThread.java:5356)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at java.lang.reflect.Method.invokeNative(Native Method)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at java.lang.reflect.Method.invoke(Method.java:515)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
08-11 18:59:51.776: E/ViewRootImpl(17050):  at dalvik.system.NativeStart.main(Native Method)