I am doing a "drawing-like" project which enables users to draw a path in ActivityB and then get a clipped photo when back to ActivityA, in which they can choose to save it for editing again next time.
The most important and the only information should be passed/saved is the (x,y) points user draws. I use two float arrays to store the value, and pass them as extra to ActivityA. (both of the float[] has a limited size, 500.)
intent.putExtra("EXTRA_X", xPoints);
intent.putExtra("EXTRA_Y", yPoints);
When saving into SQLite, I save two Strings converted from the float[] because SQLite doesn't support saving an array.
private String floatArrToStr(float[] arr) {
StringBuilder s = new StringBuilder();
for (int i = 0 ; i < length ; i++) {
s.append(arr[i]);
s.append(",");
}
return s.toString();
}
My question is, is this the best way to pass and save Points? Will using Parcelables be better (Android: Pass List<GeoPoint> to another Activity)?