зеркало из https://github.com/mono/mail-archives.git
101 строка
3.3 KiB
HTML
101 строка
3.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [mono-android] Reading from a file
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Reading%20from%20a%20file&In-Reply-To=">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="008043.html">
|
|
<LINK REL="Next" HREF="008048.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[mono-android] Reading from a file</H1>
|
|
<B>John Croft</B>
|
|
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Reading%20from%20a%20file&In-Reply-To="
|
|
TITLE="[mono-android] Reading from a file">jcroft at atlantaprogramming.com
|
|
</A><BR>
|
|
<I>Thu Dec 22 16:49:44 EST 2011</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="008043.html">[mono-android] sqlite
|
|
</A></li>
|
|
<LI>Next message: <A HREF="008048.html">[mono-android] Reading from a file
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#8044">[ date ]</a>
|
|
<a href="thread.html#8044">[ thread ]</a>
|
|
<a href="subject.html#8044">[ subject ]</a>
|
|
<a href="author.html#8044">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>I have the following code:
|
|
|
|
void OpenFile()
|
|
{
|
|
byte[] content = new byte[1024];
|
|
try
|
|
{
|
|
Stream fis = OpenFileInput(QUICKEDIT_FILENAME);
|
|
if (fis.Read(content,0,content.Length) > 0)
|
|
{
|
|
EditText editText = (EditText)FindViewById(Resource.Id.fileEditor);
|
|
UTF8Encoding enc = new UTF8Encoding();
|
|
//if (enc.GetChars(content).Length>0)
|
|
//
|
|
editText.SetText(enc.GetChars(content),0,(enc.GetChars(content)).Length-1);
|
|
}
|
|
fis.Close();
|
|
}
|
|
catch (Java.IO.FileNotFoundException e)
|
|
{
|
|
Log.Error(QUICKEDIT_TAG, e.Message);
|
|
}
|
|
catch (Java.IO.IOException e)
|
|
{
|
|
Log.Error(QUICKEDIT_TAG, e.Message);
|
|
}
|
|
}
|
|
|
|
and if I uncomment the lines that contain enc.GetChars the code hangs both
|
|
in the emulator and on a phone. No exception is thrown, the app stops
|
|
responding and has to be killed. Any thoughts would be appreciated.
|
|
|
|
TIA -
|
|
John
|
|
|
|
--
|
|
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/Reading-from-a-file-tp5095746p5095746.html">http://mono-for-android.1047100.n5.nabble.com/Reading-from-a-file-tp5095746p5095746.html</A>
|
|
Sent from the Mono for Android mailing list archive at Nabble.com.
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="008043.html">[mono-android] sqlite
|
|
</A></li>
|
|
<LI>Next message: <A HREF="008048.html">[mono-android] Reading from a file
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#8044">[ date ]</a>
|
|
<a href="thread.html#8044">[ thread ]</a>
|
|
<a href="subject.html#8044">[ subject ]</a>
|
|
<a href="author.html#8044">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
|
|
mailing list</a><br>
|
|
</body></html>
|