On Sat, May 05, 2012 at 12:12:54PM -0400, Mark Murphy wrote:
> On Sat, May 5, 2012 at 12:09 PM, Kostya Vasilyev <[email protected]> wrote:
> > Or you could just use 'raw' resources.
> >
> > They allow for resource qualifiers (res/raw, res/raw-ru, res/raw-de, etc.)
> > and text files placed there are compressed.
>
> Have you had much luck loading those into a WebView, though? I'm
> assuming that's what the OP is planning.
What I'm planning is this (part of my assetsview.java, which is passed,
via the Intent, an index indicating which file to display):
--------------------------- CUT HERE ---------------------------
InputStream is;
is = getAssets().open("foo.txt"); // where this is actually part of a
// switch to select from several files
int size = is.available();
// Read the entire asset into a local byte buffer.
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
// Convert the buffer into a string.
String text = new String(buffer);
// ADD TRANSLATION HERE
// Finally stick the string into the text view.
TextView tv = (TextView)findViewById(R.id.assets_view);
tv.setText(text);
--------------------------- CUT HERE ---------------------------
Thanks,
--jim
--
THE SCORE: ME: 2 CANCER: 0
73 DE N5IAL (/4) MiSTie #49997 < Running FreeBSD 7.0 >
[email protected] ICBM/Hurricane: 30.44406N 86.59909W
Do not look into laser with remaining eye.
Android Apps Listing at http://www.jstrack.org/barcodes.html
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en