Witajcie
męczę się strasznie i nie mogę znaleźć rozwiązania.
Aplikacja działa bez problemu w trybie debug, natomiast w trybie release nie działa. Po naciśnięciu przycisku następuje zamknięcie aplikacji.
To prościutki program, który ściąga z internetu plik tekstowy.
Może ktoś podpowie rozwiązane?
using System;
using Android.App;
using Android.Widget;
using Android.OS;
using System.Net;
namespace Blank_App
{
[Activity(Label = "Blank_App", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
WebClient webClient=new WebClient();
Uri url = new Uri("http://www.neurosoft.edu.pl/pkrutys/test.txt");
TextView txt;
string plik;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate
{
webClient.DownloadStringAsync(url);
webClient.DownloadStringCompleted += (s, e) =>
{
plik = e.Result;
txt = FindViewById<TextView>(Resource.Id.textView1);
txt.Text = plik;
};
};
}
}
}