Java 如何在android的ListView中显示SQLite数据?搜索商业应用程序

Java 如何在android的ListView中显示SQLite数据?搜索商业应用程序,java,android,sqlite,listview,android-listview,Java,Android,Sqlite,Listview,Android Listview,我不熟悉java编程和这个网站。这是我的第二个程序,但我一直在努力让SQLite数据显示在ListView项目中。我的程序正在显示业务范围,然后详细显示所选业务,很抱歉,我无法发布照片 我得描述一下 首先,ListView业务列表: 每个ListView项中有2个单元格。 左单元格有商业照片,右单元格有3个信息:粗体的商业名称、大文本、小文本的地址、可选和5星评级 第二,详细介绍所选业务: 完整页面显示所选业务的详细信息。 左上角的单元格是照片,右上角的单元格与ListView具有相同的信息,并

我不熟悉java编程和这个网站。这是我的第二个程序,但我一直在努力让SQLite数据显示在ListView项目中。我的程序正在显示业务范围,然后详细显示所选业务,很抱歉,我无法发布照片

我得描述一下

首先,ListView业务列表: 每个ListView项中有2个单元格。 左单元格有商业照片,右单元格有3个信息:粗体的商业名称、大文本、小文本的地址、可选和5星评级

第二,详细介绍所选业务:

完整页面显示所选业务的详细信息。 左上角的单元格是照片,右上角的单元格与ListView具有相同的信息,并在顶部单元格下显示说明、联系人信息和地图

我希望在listView中有企业名称、地址和评级,并且数据必须来自SQLite。我该怎么做?请帮帮我。提前感谢!!!我尝试了下面的代码,但没有成功

public class ListViewItems extends Activity {

TextView textViewHotClubs;
Button btnSortAtoZ;
Button btnSortTopRated;
Button btnNearU;
ListView listView1;

ArrayList<Integer> images = new ArrayList<Integer>();
ArrayList<String>strArray=new ArrayList<String>();

ArrayList<Object> ObjectArray = new ArrayList<Object>();    

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_view_items);

    listView1=(ListView)findViewById(R.id.listView1);
    textViewHotClubs=(TextView)findViewById(R.id.textViewHotClubs);
    btnNearU=(Button)findViewById(R.id.btnNearU);
    btnSortAtoZ=(Button)findViewById(R.id.btnSortAtoZ);
    btnSortTopRated=(Button)findViewById(R.id.btnSortTopRated);

    listView1.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {
            // TODO Auto-generated method stub
            String getText=strArray.get(arg2);
            if(getText=="Code")
            {
                Intent i=new Intent(ListViewItems.this, CodeClub.class);
                i.putExtra("pushText","Code");
                startActivity(i);
            }
            else if (getText=="Club Duo")
            {
                Intent i = new Intent(ListViewItems.this,ClubDuo.class);
                i.putExtra("pushText", "Club Duo");
                startActivity(i);
            }

        }
    });

    strArray.clear();
     images.clear();

     strArray.add("Code");
     strArray.add("Club Duo");


     images.add((int)R.drawable.dragon30x33);
     images.add((int)R.drawable.rainbow30x20);




}



@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.list_view_items, menu);
    return true;
}
}

您需要使用

创建保存数据库中数据的游标


创建CursorAdapter,它接受Cursor对象并填充UI中的数据。

要将从SQLite数据库获取的数据显示到listview中,应使用Cursor适配器。