android - Display large text from BufferedReader into viewPager fragments (text reader type implementation) -
im trying make reader app wherein data static. have saved data in text files in assets folder. want read data using bufferedreader
, display in viewpager
. user goes on swiping right, pages should added viewpager
along data bufferedreader
if there data display.
this getitem function inside viewpageradapter.
public fragment getitem(int i) { fragment pagefragment = new pagefragment(); stringbuilder sb = new stringbuilder(); bufferedreader reader = null; try { inputstream file = context.getassets().open("chap1.txt"); reader = new bufferedreader(new inputstreamreader(file)); // reading, loop until end of file reading string mline = reader.readline(); while (mline != null) { //process line sb.append(mline); sb.append("\n"); mline = reader.readline(); } } catch (ioexception e) { //log exception } { if (reader != null) { try { reader.close(); } catch (ioexception e) { //log exception } } } //log.e("read text", sb.tostring()); bundle bundle = new bundle(); bundle.putstring("content", sb.tostring()); pagefragment.setarguments(bundle); return pagefragment; }
i dont want pages have scroll views.
how can achieve this?
how can limit text read bufferedreader? or how can split text data , add different fragments? if problem not clear, please ask questions. im not able explain properly. ps: other approach welcomed.
Comments
Post a Comment