У меня есть приложение для Android, которые получают данные из sqlite и отображают данные в BaseAdapter .. Каков наилучший способ ??

У меня есть приложение для Android, которое извлекает данные из базы данных sqlite и отображает эти данные в listView, который расширяет BaseAdapter.

в этом приложении у меня есть изображения в папке drawable, и у меня есть в sqlite поле, которое содержит название этих изображений.

мой вопрос, как получить эти данные и отобразить их в виде списка?

я прочитал этот урок :(http://www.androidhub4you.com/2012/09/hello-friends-today-i-am-going-to-share.html).

мой вопрос есть ли другой способ сделать это?

Я буду признателен за любую помощь.

row_list_match_schedulle.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textGroup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="Group"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/txtDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="Date"
        android:textAppearance="?android:attr/textAppearanceSmall" />



    <TextView
        android:id="@+id/textName1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/imageView1"
        android:layout_alignParentLeft="true"
        android:text="name1" />

    <TextView
        android:id="@+id/textName2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/imageView2"
        android:layout_alignParentRight="true"
        android:text="Name2" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textLocation"
        android:layout_toRightOf="@+id/textName1"
        android:adjustViewBounds="true"
        android:maxHeight="40dp"
        android:maxWidth="40dp"
        android:scaleType="fitCenter"
        android:src="@drawable/algeria_flag" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/imageView1"
        android:layout_toLeftOf="@+id/textName2"
        android:adjustViewBounds="true"
        android:maxHeight="40dp"
        android:maxWidth="40dp"
        android:scaleType="fitCenter"
        android:src="@drawable/algeria_flag" />

    <TextView
        android:id="@+id/textLocation"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textGroup"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="18dp"
        android:text="Location" />

</RelativeLayout>
ItemDetails.java
package com.devleb.expandablelistdemo3;

public class ItemDetails {

    String stad_name;
    String team1;
    String team2;
    String match_date;
    String flags1;
    String 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 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 getFlags1() {
        return flags1;
    }
    public void setFlags1(String flags1) {
        this.flags1 = flags1;
    }
    public String getFlags2() {
        return flags2;
    }
    public void setFlags2(String flags2) {
        this.flags2 = flags2;
    }
    public String getGroup() {
        return group;
    }
    public void setGroup(String group) {
        this.group = group;
    }


}

это то, что я написал до сих пор вBaseAdapter

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.TextView;

public class CustomAdapterMatchSchedule extends BaseAdapter {

    LayoutInflater layoutInflater;
    ArrayList<ItemDetails> itemdetailList;
    Context context;

    public CustomAdapterMatchSchedule(Context c, ArrayList<ItemDetails> listOfItem){
        this.context = c;
        itemdetailList = listOfItem;
    }

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

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return itemdetailList.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 itemListDetails = itemdetailList.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(itemListDetails.getStad_name());
        //team1
        TextView txtTeam1 = (TextView)convertView.findViewById(R.id.textName1);
        txtTeam1.setText(itemListDetails.getTeam1());
        //team2
        TextView txtTeam2 = (TextView)convertView.findViewById(R.id.textName2);
        txtTeam2.setText(itemListDetails.getTeam2());
        //flag1
        TextView txtflag1 = (TextView)convertView.findViewById(R.id.imageView1);
        txtflag1.setText(itemListDetails.getTeam1());

        //flag2

        return null;
    }

}

Ответы на вопрос(1)

Ваш ответ на вопрос