SurfaceView extremely low framerate.

  • Replies:3
some guy
  • Forum posts: 3

Aug 10, 2014, 6:19:20 AM via Website

For some reason when using surface view I'm getting around 5 fps... Here's an idea of what I coded to measure the fps:

//game loop part of code(in another thread)
long start = System.currentTimeMillis();
while(game running){
     end = System.currentTimeMillis();
          if ((end - start) >= 1000) {
              Log.d("PERSONAL", "FPS: " + fps + "    milliseconds " +     Long.toString(end - start));
              start = System.currentTimeMillis();
              fps = 0;
          }
drawMethod();

}

//DrawMethod
public void drawMethod(){
    fps++;
} 

My question is how do I fix this problem of having such a low frame rate? Is this normal when using a surfaceview? And if so, how can I fix it?

Reply
some guy
  • Forum posts: 3

Aug 12, 2014, 2:49:29 AM via Website

I would really appreciate some help..

Reply
Ben E
  • Forum posts: 14

Aug 21, 2014, 3:03:54 PM via Website

I also have encountered this problem. If someone had an answer for this it would be really great...

Reply
Frangulyan
  • Forum posts: 18

Aug 24, 2014, 12:51:10 PM via Website

If I'm not mistaken, surface views doesn't support hardware acceleration yet, so strangely sometimes it is faster to draw in normal view's onDraw().

Reply