protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            ContentResolver cr = ContentResolver;
            // Create your application here
            
            // タイトルバーを消す
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.SingleImage);   // <--追加

            // 上に戻るボタンを表示
            //ActionBar.SetDisplayHomeAsUpEnabled(true);
            Button textview = FindViewById<Button>(Resource.Id.textView1);
            using (ImageButton button = FindViewById<ImageButton>(Resource.Id.imageButton1))
            //ImageView button = FindViewById<ImageView>(Resource.Id.imageButton1);
            {

                //this.Title = "ここに画像のファイル名が入ります";
                textview.Text = "ここに解析結果が入ります";

                var intent = this.Intent;
                if (intent != null && intent.HasExtra("data"))
                {
                    //Android.Net.Uri imgUri;
                    card = intent.GetParcelableExtra("data") as ImageItemforUI;
                    var tags = _db.GetImgTagInfo(card.imageId);
                    string tagtext = "";
                    //Title = card.path;
                    if (tags.Length == 0)
                        tagtext = "この画像は未解析です。この部分をクリックすると解析します。";
                    for (int i = 0; i < tags.Length; i++)
                    {
                        tagtext += tags[i].TagStr;
                        tagtext += ", ";
                    }
                    textview.Text = tagtext;
                    try
                    {
                        showBitmap(card.path);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }


                textview.Click += async delegate
                {
                    textview.Text = "現在解析中です。しばらくお待ちください。";

                    string[] resulttags = new string[0];
                    string inputfilename;
                    inputfilename = card.path;
                    try
                    {
                        resulttags = await CV2Tag.getTag(inputfilename);
                        textview.Text = "";
                        foreach (string s in resulttags)
                        {
                            textview.Text += s;
                            textview.Text += ", ";
                        }
                    }
                    catch (WebException ex)
                    {
                        // 通信エラー
                        Log.WriteLine(LogPriority.Info, ex.Source, ex.Message);
                        textview.Text = "通信エラーのため取得できませんでした。";
                    }
                    // ひとまずDBに書き込み
                    _db.SaveImgTagInfo(card.imageId, resulttags);
                };

                button.Click += delegate
                {
                    //Intent intent = new Intent(Intent.ActionMediaShared, uri);

                    // StartActivity(intent);
                    // http://kittoworks.hateblo.jp/entry/2015/07/02/171103
                    Java.IO.File file = new Java.IO.File(card.path);
                    Intent shareIntent = new Intent();
                    // Intent.ACTION_VIEWを指定すると表示、
                    // Intent.ACTION_SHAREを指定すると共有、
                    // Intent.ACTION_EDITを指定すると編集を行うアプリを呼び出せる。
                    shareIntent.SetAction(Intent.ActionSend);
                    shareIntent.SetDataAndType(Android.Net.Uri.FromFile(file), "image/jpeg");
                    shareIntent.PutExtra(Intent.ExtraStream, Android.Net.Uri.FromFile(file));
                    StartActivity(shareIntent);
                };
            }
        }
        private void viewImgGrid(string inputTag = null)
        {
            ContentResolver cr = ContentResolver;
            List<ImageItem> dbImageItems = new List<ImageItem>();
            GridView gridview = null;
            try
            {
                gridview = FindViewById<GridView>(Resource.Id.gridview);
            }
            catch
            {
                Console.WriteLine("GridViewの取得に失敗しました");
            }
            var adp = new ImageAdapter(this, cr);

            // DBのテスト

            /*ImageItem tempItem = new ImageItem()
            {
                ImageId = DateTime.Now.Millisecond,
                Path = "temp" + DateTime.Now.Millisecond.ToString(),
                DateModified = DateTime.Now
            };*/
            //_db.SaveItem(tempItem); 
            //string st = "";
            try
            {
                TagItem[] temp;
                if (inputTag != null)
                {
                    temp = new TagItem[1];
                    temp[0] = new TagItem { TagId = _db.getandWriteTagId(inputTag) };
                }
                else {
                    temp = null;
                }
                var ItemsSource = _db.GetItems(temp);
                //var ItemsSource = _db.GetItemList();
                foreach (ImageItem i in ItemsSource)
                {
                    dbImageItems.Add(i);
                    //st += i.Path + " ";
                }
                //tagEditBox.Text = st;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            adp.AddImageIds(dbImageItems);
            gridview.Adapter = adp;

            DateTime lastUpdatedlocal = DateTime.Now;
            lastUpdated = lastUpdatedlocal;
            gridview.ItemClick += delegate (object sender, AdapterView.ItemClickEventArgs args)
            {
                if (lastUpdated == lastUpdatedlocal)
                {
                    using (var intent = new Intent(this, typeof(SingleImageActivity)))
                    {
                        int position = args.Position;
                        ImageItemforUI intentData = new ImageItemforUI(dbImageItems[position]);
                        //Toast.MakeText(this, dbImageItems[position].Path, ToastLength.Short).Show();

                        intent.PutExtra("data", intentData);
                        StartActivity(intent);
                    }
                }else
                {
                    Console.WriteLine("過去に作成されたイベントが呼ばれました。");
                }
                //StartActivityForResult(intent,0);
            };
        }