Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Android.Widget;
- using Android.App;
- using System.Collections.Generic;
- using Android.Views;
- using Android.Media;
- using System.Net;
- using System.Threading.Tasks;
- using System.IO;
- using Android.Graphics;
- namespace PariwisataJateng
- {
- public class HotelListAdapter : BaseAdapter<Hotel>
- {
- public HotelListAdapter()
- {
- }
- Activity context;
- List<Hotel> list;
- public HotelListAdapter(Activity _context, List<Hotel> _list) : base()
- {
- this.context = _context;
- this.list = _list;
- }
- public override int Count
- {
- get { return list.Count; }
- }
- public override long GetItemId(int position)
- {
- return position;
- }
- public override Hotel this[int index]
- {
- get { return list[index]; }
- }
- public override View GetView(int position, View convertView, ViewGroup parent)
- {
- View view = convertView;
- // re-use an existing view, if one is available
- // otherwise create a new one
- if (view == null)
- view = context.LayoutInflater.Inflate(Resource.Layout.ListHotelRow, parent, false);
- Hotel item = this[position];
- //view.FindViewById<TextView>(Resource.Id.HargaTiket).Text = item.harga_tiket;
- view.FindViewById<TextView>(Resource.Id.NamaHotel).Text = item.nama_hotel;
- view.FindViewById<TextView>(Resource.Id.AlamatHotel).Text = item.alamat;
- using (var imageView = view.FindViewById<ImageView>(Resource.Id.FotoHotel))
- {
- string url = Android.Text.Html.FromHtml(item.foto).ToString();
- //Download and display image
- Koush.UrlImageViewHelper.SetUrlDrawable(imageView,
- url, Resource.Drawable.loadimage);
- }
- return view;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement