I have a TextView in my application that works fine until I pause the application (when I click on the house) and run it again. It should just resume the action, but for some reason the TextView does not display the text correctly after the action resumes. The text appears as black squares, for example:
http://i.stack.imgur.com/5mtvy.png
Does anyone know how to fix this?
EDIT: Here's my code: A TextView is created in an xml layout that has a GLSurfaceView (called a GameView), and on top of that is a TextView. Here's the xml code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="MainActivity" > <GameView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/gv" /> <TextView android:layout_width="100dp" android:layout_height="100dp" android:textColor="@android:color/black" android:id="@+id/tv" /> </RelativeLayout>
And here is the code in the MainActivity onCreate method:
setContentView(R.layout.activity_main); GameView gameView = (GameView) findViewById(R.id.gv); TextView textView = (TextView) findViewById(R.id.tv);
The methods onPause, onResume, onStart, onStop have nothing to do with TextView. The TextView is stored in the instance variable for MainActivity, and then TextView.setText () is called to set the TextView text.
EDIT: I was able to fix this problem by commenting on one line: GLES20.glDeleteTextures (...) that is called onPause () I have no idea how this is even related or why calling this function caused this problem, but when I comment on it, the problem disappears, and when I return this line, the problem returns with it. If someone can explain how one relates to the other, it will be very grateful.
source share