java - load a unicode file help.htm into a webview in main thread -


i trying load file "assets/help-english/help.htm" webview [named howto]. catches ioexception , loads error message webview. find in logcat "the application may doing work on main thread".

do need create thread process or have different problem resulting in message? have code creating thread not problem. not want if have missed something.

i think may have missed because have succesfully read assets in past without creating separate thread.

the files in unicode display in various languages. have used google translate that. simple unicode text files less 10k bytes created using simple html editor , notepad.

the log.i statements display expected text. 1 in while loop not executed.

assetmanager = activity.getassets(); stringbuilder sb = new stringbuilder(1024); string linehelp;  log.i(tag, "locale = " + locale.getdefault().getdisplaylanguage()); log.i(tag, "locale = " + locale.getdefault()); try {     inputstream = am.open("help-" +     locale.getdefault().getdisplaylanguage()      + "/help.htm"); bufferedreader br = new bufferedreader(new inputstreamreader(is)); while((linehelp = br.readline()) != null) {     log.i(tag, "linehelp = " + linehelp + "\n");     sb.append(linehelp); } } catch (ioexception e) {     sb.append(getstring(r.string.helpfileproblem));     sb.append(e.getmessage()); } linehelp = sb.tostring(); log.i(tag, "linehelp = " + linehelp); howto.loaddatawithbaseurl(null, linehelp, "text/html", "unicode", null); 

you don't need use different thread, if assets file large enough, reading file take enough time android complain.

"if have operations perform not instantaneous, should make sure them in separate threads ("background" or "worker" threads)." processes , threads.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -