shorty shorty - 1 month ago 6x
Java Question

how to get sharredpreffence to work with previewsize

how do i getting sharredprefference to work for preview size

in my tektsoks it is stands like 352, 288

Previewsize = setingPreferences.getString("screensize", "");

here i get

set previewsize (int, int )in parameters cannot be applied to int

i had tryed with


but here i gets

cannot resolve method getstring


To start out with the two compiler errors you're receiving:

setPreviewSize (int, int ) in parameters cannot be applied to int

This tells you, that you're trying to parse a single int to the setPreviewSize method, while it actually takes two ints.

cannot resolve method getString

This simply means there's no method called getString.

If Previewsize is your string containing 352,288, you can perform a String split operation to split the two values into an array with two entries.

String previewSize = setingPreferences.getString("screensize", "");
String[] sizes = previewSize.split(",");
parameters.setPreviewSize(Integer.parseInt(sizes[0]), Integer.parseInt(sizes[1]);