WebView, add local .CSS file to an HTML page?

Seva Alekseyev is right, you should store CSS files in assets folder, but referring by file:///android_asset/filename.css URL doesn’t working for me. There is another solution: put CSS in assets folder, do your manipulation with HTML, but refer to CSS by relative path, and load HTML to WebView by loadDataWithBaseURL() method: webView.loadDataWithBaseURL(“file:///android_asset/”, htmlString, “text/html”, “utf-8”, null); … Read more

OCUnit & NSBundle

Found only one solution for this problem. When I build my unit-tests, the main bundle’s path is not equal to my project’s bundle (created .app file). Moreover, it’s not equal to LogicTests bundle (created LogicTests.octest file). Main bundle for unit-tests is something like /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/Developer/usr/bin. And that’s why program can’t find necessary resources. And the final … Read more

Where can I obtain an English dictionary with structured data? [closed]

Go to http://www.speech.cs.cmu.edu/cgi-bin/cmudict and you will find the download page for the pronunciation dictionary at https://cmusphinx.svn.sourceforge.net/svnroot/cmusphinx/trunk/cmudict/ The latest version is currently cmudict.0.7a. This is what I am currently using to implement the syllable counter for http://www.haikuvillage.com. It’s in Ruby and I’d be happy to open source it for you if that helps.

Access resource files in Android

If you have a file in res/raw/textfile.txt from your Activity/Widget call: getResources().openRawResource(…) returns an InputStream The dots should actually be an integer found in R.raw… corresponding to your filename, possibly R.raw.textfile (it’s usually the name of the file without extension) new BufferedInputStream(getResources().openRawResource(…)); then read the content of the file as a stream

Using IDisposable object in method that returns IEnumerable

When you use yield keyword compiler generates nested class, which implements IEnumerable, IEnumerator and IDisposable and stores all context data: [CompilerGenerated] private sealed class <Read>d__0 : IEnumerable<YourObject>, IEnumerable, IEnumerator<YourObject>, IEnumerator, IDisposable { // Fields private int <>1__state; private YourObject <>2__current; public string <>3__filename; public Foo <>4__this; private int <>l__initialThreadId; public FileStream <filestream>5__1; public string <line>5__3; … Read more

Get path of Android resource

Use URI Paths instead of “absolute” path, see this post Uri path = Uri.parse(“android.resource://com.segf4ult.test/” + R.drawable.icon); Uri otherPath = Uri.parse(“android.resource://com.segf4ult.test/drawable/icon”); Or use openRawResource(R.id) to open an inputStream, and use it the same way you would use a FileInputStream (readonly)