Hi,

I just want to access to a .txt file in the assets folder. this is my code :

protected override void OnCreate (Bundle bundle)
                {
                        base.OnCreate (bundle);
                                                
                        var tv = new TextView(this);
                        string s = "";
                        
                        try{
                                Stream input = Assets.Open("test.txt");
                                StreamReader st = new StreamReader(input);
                                
                                string ligne = st.ReadLine();

                                while (ligne != null) 
                            {
                                        s +=ligne+"\n";
                                ligne = st.ReadLine();
                            } 
                                
                                st.Close();
                        }
                        catch(Exception e){
                                s += "Message d'erreur :\n"+e.Message;
                        }
                        
                        tv.Text = "TEXTE : "+s;
                        
                        SetContentView(tv);
                }

And when I test my application, it displays "Exception of type
'Java.IO.FileNotfoundException' was thrown. So, they don't find my file
whereas I put the "test.txt" in the Assets folder. Why ?

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Problem-to-access-assets-files-tp4422037p4422037.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to