3

I'm using surfaceview in my work. My requirement is to make a curved line in a vertical scrollview. When I test it I found when the height is less than 4096 it works well, but more than that (even just 4097), it crashes!

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    // TODO Auto-generated method stub
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), 4097);
}

Can anyone tell me why?

Steve Lillis
  • 3,263
  • 5
  • 22
  • 41
parcool
  • 113
  • 1
  • 8

1 Answers1

2

The reason might me the max supported texture size of your device.

Which seem to be 4096 in your case.You should not use bigger values for your surface.

Take a look at: How can I find the maximum texture size for different phones?

to find what texture sizes are supported

Community
  • 1
  • 1
daemmie
  • 6,361
  • 3
  • 29
  • 45
  • Thanks for your answer,But if i have to make a line of it height more than 4096,is there any way to do? – parcool Jun 24 '15 at 08:04
  • I guess not, if the texture is just 4096x4096, you can just draw on that are. There might be an alternative solution for you problem. But its hard to help you at this point. You might open an other question for the line drawing issue. – daemmie Jun 24 '15 at 08:13