This is a xamarin application for android to compress or extract a given file entered by user in the textbox. I placed the sample file in the assets folder. The function zip on button click is supposed to compress the file On entering the filename and clicking the button it is throwing a filenotfound exception even after providing path of the file located.
namespace zipfile
{
[Activity (Label = "zipfile", MainLauncher = true)]
public class MainActivity : Activity
{
string t;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
Button button1 = FindViewById<Button> (Resource.Id.button1);
button1.Click += delegate {
EditText text = FindViewById<EditText>
(Resource.Id.editText2);
if (null == text)
return;
t="\\zip\\zipfile\\Assets\\"+ text.Text;
//Toast.MakeText(this,"file
zipped",ToastLength.Long).Show();
ZipOutputStream.Zip(t, t, 128);
};
Button button2 = FindViewById<Button> (Resource.Id.button2);
button2.Click += delegate {
//Toast.MakeText(this,"file
unzipped",ToastLength.Long).Show();
ZipInputStream.UnZip (t, t, 128);
};
}
}
}
I am new To Xamarin Please suggest me way to handle this exception.