Ejemplo n.º 1
0
 private void setDisplayImage(/*final*/ ImageView iv, /*final*/ String url)
 {
     // Show the remote image in ImageView.
     if (GetFromCache(url) != null)
     {
         iv.SetImageBitmap(GetFromCache(url));
     }
     else
     {
         /*
          * java
          * new DemoHelper.RemoteImageTask
          *                      (
          *                        iv
          *                      , url
          *                      , new TaskCallback()
          *                              {
          *                      //@Override
          *                     public override void onTaskFinished(Bitmap bmp)
          *                                      {
          *                          putToCache(url, bmp);
          *                      }
          *                  }
          *                      ).execute();
          */
         DemoHelper.RemoteImageTask rit = new DemoHelper.RemoteImageTask
                                          (
             iv                                                  // ImageView to be filled (placeholder)
             , url
                                          );
         rit.Execute();
     }
 }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_demo_simple);

            Resources res         = this.Resources;
            string    description = res.GetString(Resource.String.pin_desc_kitten);

            (FindViewById <TextView> (Resource.Id.desc_tv)).Text = description;
            mImage = FindViewById <ImageView> (Resource.Id.source_iv);

            // Show the remote image in ImageView.
            // TODo: not working
            DemoHelper.RemoteImageTask rit = new DemoHelper.RemoteImageTask
                                             (
                mImage                                                  // ImageView to be filled (placeholder)
                , IMAGE_SOURCE
                                             );
            rit.Execute();

            PinItButton pinIt = FindViewById <PinItButton> (Resource.Id.pin_bt);

            pinIt.ImageUrl    = IMAGE_SOURCE;
            pinIt.Url         = WEB_URL;
            pinIt.Description = description;
            pinIt.Listener    = _listener;

            // works
            //mImage.SetImageResource(Resource.Drawable.xamarin_x);
            //mImage.SetImageBitmap(rit.BitMapShown);
            mImage = rit.ImageViewShown;

            return;
        }
Ejemplo n.º 3
0
 private void setDisplayImage(/*final*/ ImageView iv, /*final*/ String url)
 {
     // Show the remote image in ImageView.
     if (GetFromCache(url) != null)
     {
         iv.SetImageBitmap(GetFromCache(url));
     }
     else
     {
         DemoHelper.RemoteImageTask rit = new DemoHelper.RemoteImageTask
                                          (
             iv                                                  // ImageView to be filled (placeholder)
             , url
                                          );
         rit.Execute();
     }
 }