Skip to content

Instantly share code, notes, and snippets.

@uruskan
Created October 24, 2017 20:42
Show Gist options
  • Save uruskan/9522b956e961c893b2296773f1faf934 to your computer and use it in GitHub Desktop.
Save uruskan/9522b956e961c893b2296773f1faf934 to your computer and use it in GitHub Desktop.
Ozel Adapter ama offlineli yani çöp ama başlangıç için mükemmel ne yazdım beeee
package upiynar.cback;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.util.List;
/**
* Created by shock on 10/24/2017.
*/
public class OzelAdapter extends BaseAdapter{
private LayoutInflater mInflater;
private List<Etkinlik> mEtkinlikListesi;
public OzelAdapter(Activity activity,List<Etkinlik> etkinlikler){
//XML'i alıp View'e çevirecek inflater'ı örnekleyelim.
mInflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mEtkinlikListesi = etkinlikler;
}
@Override
public int getCount() {
return mEtkinlikListesi.size();
}
@Override
public Object getItem(int position) {
return mEtkinlikListesi.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View etkinlikLayout;
etkinlikLayout = mInflater.inflate(R.layout.etkinlik_layout,null);
TextView baslik = (TextView) etkinlikLayout.findViewById(R.id.Baslik);
TextView kisaAciklama = (TextView) etkinlikLayout.findViewById(R.id.kisaAciklama);
TextView Tarih = (TextView) etkinlikLayout.findViewById(R.id.Tarih);
ImageView simge = (ImageView) etkinlikLayout.findViewById(R.id.simge);
Etkinlik etkinlik = mEtkinlikListesi.get(position);
baslik.setText(etkinlik.getBaslik());
kisaAciklama.setText(etkinlik.getKisaAciklama());
Tarih.setText(etkinlik.getTarih());
simge.setImageDrawable(etkinlik.getSimge());
return etkinlikLayout;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment