protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            // this method is currently not working
            //Start();

            notesListView = FindViewById <ListView>(Resource.Id.notesListView);

            notes = await db.GetItemsAsync();

            NotesListViewAdapter adapter = new NotesListViewAdapter(this, notes);

            notesListView.Adapter = adapter;

            // api operations
            // operacje związane z api
            var simpleNotesService = new SimpleNotesService();

            if (isOnline())
            {
                // removing all notes from sql server database
                // usunięcie wszystkich notatek z serwera
                List <Notes> no = await simpleNotesService.GetNotesAsync(Uri);

                if (no != null)
                {
                    await simpleNotesService.DeleteAllNotesAsync("http://smnotes.azurewebsites.net/api/",
                                                                 "deleteallnotes");
                }

                // if there are notes saved offline in local database
                // upload them to the sql server
                // jeżeli jakieś notatki były zapisane lokalnie bez dostępu do internetu
                // to należy je wysłać na serwer
                if (notes != null)
                {
                    foreach (Notes n in notes)
                    {
                        Notes note = new Notes()
                        {
                            Note_ID = n.Note_ID, Title = n.Title, Note = n.Note
                        };
                        await simpleNotesService.PostNotesAsync(Uri, note);
                    }
                    GetSqlID();
                }
            }



            ///////////////////


            notesListView.ItemClick += delegate(object sender, ItemClickEventArgs args)
            {
                Intent details_activity = new Intent(this, typeof(DetailsActivity));
                details_activity.PutExtra("ID", notes[(int)args.Id].Note_ID);
                details_activity.PutExtra("sqlID", notes[(int)args.Id].sqlNote_ID);
                details_activity.PutExtra("title", notes[(int)args.Id].Title);
                details_activity.PutExtra("note", notes[(int)args.Id].Note);
                StartActivity(details_activity);
            };

            notesListView.ItemLongClick += delegate(object sender, ItemLongClickEventArgs args)
            {
                AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                AlertDialog         alert  = dialog.Create();
                alert.SetMessage("Czy na pewno chcesz usunąć tę notatkę?");
                alert.SetButton("OK", async(c, ev) =>
                {
                    Notes delNote = new Notes()
                    {
                        Note_ID    = notes[(int)args.Id].Note_ID,
                        sqlNote_ID = notes[(int)args.Id].sqlNote_ID,
                        Title      = notes[(int)args.Id].Title,
                        Note       = notes[(int)args.Id].Note
                    };
                    await db.DeteleItemAsync(delNote);
                    notes.RemoveAt((int)args.Id);
                    // if there is an Internet connection, we have to delete selected note
                    // also from sql server database
                    // jeżeli jest połączenie z Internetem trzeba usunąć notatkę także z serwera
                    if (isOnline())
                    {
                        await simpleNotesService.DeleteNotesAsync(Uri, delNote.sqlNote_ID);
                    }
                    adapter = new NotesListViewAdapter(this, notes);

                    notesListView.Adapter = adapter;
                });
                alert.SetButton2("Anuluj", (c, ev) => { });
                alert.Show();
            };
        }