如何从我的drawable文件夹中获取图像并使用sqlite存储和检索这些图像并将其显示在listview中以扩展基本适配器

时间:2014-04-26 17:53:37

标签: android sqlite android-listview baseadapter

我有一个使用包含数据的sqlite的android应用程序(图像为BLOB类型)我需要获取这些图像并将其显示在扩展BaseAdapter的listview中

我将不胜感激任何帮助

ItemDetails.java

package com.devleb.expandablelistdemo3;

public class ItemDetails {

    String stad_name;
    String team1;
    String team2;
    String match_date;
    byte[] flags1;
    byte[] flags2;
    String group;

    public String getStad_name() {
        return stad_name;
    }

    public void setStad_name(String stad_name) {
        this.stad_name = stad_name;
    }

    public String getTeam1() {
        return team1;
    }

    public void setFlags1(byte[] flags1) {
        this.flags1 = flags1;
    }

    public void setFlags2(byte[] flags2) {
        this.flags2 = flags2;
    }

    public void setTeam1(String team1) {
        this.team1 = team1;
    }

    public String getTeam2() {
        return team2;
    }

    public void setTeam2(String team2) {
        this.team2 = team2;
    }

    public String getMatch_date() {
        return match_date;
    }

    public void setMatch_date(String match_date) {
        this.match_date = match_date;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    String Name;
    int image;

    public String getName() {
        return Name;
    }

    public void setName(String name) {
        Name = name;
    }

    public int getImage() {
        return image;
    }

    public void setImage(int image) {
        this.image = image;
    }

}

这就是我现在写的如何从这里继续获取图片???

CustomAdapterMatchSchedule.java

package com.devleb.expandablelistdemo3;

import java.util.ArrayList;

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;

public class CustomAdapterMatchSchedule extends BaseAdapter {

    ArrayList<ItemDetails> itemdetailsList;
    Context context;

    public CustomAdapterMatchSchedule(Context context, ArrayList<ItemDetails> list) {

            this.context = context;
            itemdetailsList = list;
        }




    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return itemdetailsList.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return itemdetailsList.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup arg2) {
        // TODO Auto-generated method stub
        ItemDetails itemdetail = itemdetailsList.get(position);

        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.row_list_match_schedule, null);
        }
      //Stad_name
        TextView txtStadName = (TextView)convertView.findViewById(R.id.textLocation);
        txtStadName.setText(itemdetail.getStad_name());
        //team1
        TextView txtTeam1 = (TextView)convertView.findViewById(R.id.textName1);
        txtTeam1.setText(itemdetail.getTeam1());
        //team2
        TextView txtTeam2 = (TextView)convertView.findViewById(R.id.textName2);
        txtTeam2.setText(itemdetail.getTeam2());
        //flag1
        ImageView imgflag1 = (ImageView)convertView.findViewById(R.id.imageView1);
        imgflag1.







        return null;
    }

}

0 个答案:

没有答案