Android: fill spinner with items in text file output truncated -
android: fill spinner items in text file , output truncated
my source file fill spinner in android form it's country txt.
if using version items in spinner stopping , truncate country: "french polyn": http://www.filesnack.com/files/ctjlom8p
if using other country txt file: http://www.filesnack.com/files/ct9sr3fn
the spinner populated correctly ... why ?
<spinner android:id="@+id/my_spinner_new" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:singleline="true" android:spinnermode="dialog" />
import country txt file in spinner with:
string path = "http://www.remotehost.com/public/country.txt"; url u = null; try { u = new url(path); httpurlconnection c = (httpurlconnection)u.openconnection(); c.setrequestmethod("get"); c.connect(); inputstream in = c.getinputstream(); final bytearrayoutputstream bo = new bytearrayoutputstream(); byte[] buffer = new byte[1024]; in.read(buffer); bo.write(buffer); string s = bo.tostring(); final vector<string> str = new vector<string>(); string[] line = s.split("\n"); int index = 0; while (index < line.length) { str.add(line[index]); index++; }
i guess because limit buffer 1024 kbytes. first file more 2048, second 1 850 only. reason.
Comments
Post a Comment