Never do this during onDrawFrame in GLSurfaceView.Renderer
I checked on meta to be sure this was a decent thing to do (sharing a situation and solution instead of asking a direct question) and all answers point to yes, so I'm here to share an experience.

I began with C, and Java is still somewhat new to me. Along with Java came Garbage Collection and I quickly took that for granted.

A game I've been working on has been coming along nicely, until I added a fps counter and these insidious lines in my onDrawFrame() method for my GLSurfaceView.Renderer:

    		mActivity.runOnUiThread(new Runnable(){
    			public void run() {
    				mActivity.fpsCounter.setText(String.format("%.2f fps", fps));
    			}
    		});

this is called once every 10 frames, and fps is a float value which figured the frames per second. God forbid I'd ran it every frame...

The result of this was a garbage collection call that began to occur every 4 to 5 seconds or so, freeing several thousand items. I'm actually still looking into it further to be sure I'm not leaking elsewhere, but my virgin Java coding chops woke up and realized (thanks to the DDMS allocation tracker) that calling that ultimately triggered a metric ton of allocations from java.util.Formatter, not to mention all of the Strings I was pumping out.

Lesson learned to those, like me, new to Java... DON'T TAKE STRINGS FOR GRANTED. I had innocently developed a very bad habit and it had me digging around for quite some time till I found out how to use the DDMS Allocation Tracker and was hit with a truck load of light bulbs.
Never do this during onDrawFrame in GLSurfaceView.Renderer
===

I checked on meta to be sure this was a decent thing to do (sharing a situation and solution instead of asking a direct question) and all answers point to yes, so I'm here to share an experience.

I began with C, and Java is still somewhat new to me. Along with Java came Garbage Collection and I quickly took that for granted.

A game I've been working on has been coming along nicely, until I added a fps counter and these insidious lines in my onDrawFrame() method for my GLSurfaceView.Renderer:

    		mActivity.runOnUiThread(new Runnable(){
    			public void run() {
    				mActivity.fpsCounter.setText(String.format("%.2f fps", fps));
    			}
    		});

this is called once every 10 frames, and fps is a float value which figured the frames per second. God forbid I'd ran it every frame...

The result of this was a garbage collection call that began to occur every 4 to 5 seconds or so, freeing several thousand items. I'm actually still looking into it further to be sure I'm not leaking elsewhere, but my virgin Java coding chops woke up and realized (thanks to the DDMS allocation tracker) that calling that ultimately triggered a metric ton of allocations from java.util.Formatter, not to mention all of the Strings I was pumping out.

Lesson learned to those, like me, new to Java... DON'T TAKE STRINGS FOR GRANTED. I had innocently developed a very bad habit and it had me digging around for quite some time till I found out how to use the DDMS Allocation Tracker and was hit with a truck load of light bulbs.