You assume that preview sizes are returned in descending order.
val sizes = parameters.supportedPreviewSizes
//val index = sizes.size/2 // ~medium resolution
val index = if (ConfigurationInfo(this).isFullFrame) 0 else sizes.size/2
for (size in sizes) {
Log.d(TAG, "width: ${size.width}, height: ${size.height}")
}
Log.d(TAG,"will use: ${sizes[index].width}, height: ${sizes[index].height}")
parameters.setPreviewSize(sizes[index].width, sizes[index].height)
This is not true on Gooclever TAB 813G. It return as first the lowest resolution. You should check sizes directly (ie. width*height) or sort this list by resolution size before.
You assume that preview sizes are returned in descending order.
This is not true on Gooclever TAB 813G. It return as first the lowest resolution. You should check sizes directly (ie. width*height) or sort this list by resolution size before.