I am trying to obtain the bitmap from a GraphView in order to not generate twice the same graph. I am continously getting the the following error (despite having the hardwareAccelerated=true):
java.lang.IllegalStateException: GraphView must be used in hardware accelerated mode.You can use android:hardwareAccelerated="true" on your activity
-Here is the code where I try to do this:
ImageView imageView = (ImageView) convertView.findViewById(R.id.imageView);
Bitmap bitmap = Bitmap.createBitmap(graphView.getWidth(), graphView.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Drawable bgDrawable = graphView.getBackground();
if (bgDrawable != null) {
bgDrawable.draw(canvas);
} else {
canvas.drawColor(Color.BLUE);
}
graphView.draw(canvas);
imageView.setImageBitmap(bitmap);
I've tried several things but no one with sucess. I've tried even to put the graphView inside a layout and get the bitmap from the layout but this didn't worked either (i get exactly the same error).
Any help would be appreciated!