1
Answer

Android app using C# trying to make txt file but it stuck on BufferedWritter()...

Saqi

Saqi

12y
2k
1
protected override void OnCreate(Android.OS.Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);


            Button save = (Button)FindViewById(Resource.Id.Save);
            save.Click += new System.EventHandler(save_Click);
            
            nome = (EditText)FindViewById(Resource.Id.Nome);
            numero_domicilio = (EditText)FindViewById(Resource.Id.numero_domicilio);
            data_nasci = (EditText)FindViewById(Resource.Id.data_nasci);
            data_morte = (EditText)FindViewById(Resource.Id.data_morte);
            masculina = (CheckBox)FindViewById(Resource.Id.Masculino);
            feminina = (CheckBox)FindViewById(Resource.Id.Feminino);
            escolaridade = (EditText)FindViewById(Resource.Id.Escolaridade);
            estuda_altuamento = (CheckBox)FindViewById(Resource.Id.estuda_altuamento);
            
        }
private void save_Click(object sender, System.EventArgs e)
            {
                File my = new File("my.txt");
             try
             {
                 my.CreateNewFile();
             } catch
             {
             }
             try
             {
                 BufferedWriter rite = new BufferedWriter(new FileWriter(my, true));
                 rite.Write(nome.ToString());
                 rite.Flush();
                 rite.Close();
             } catch
             {
             }


            }



         };
        }

Answers (1)