首页>代码>Android仓库管理系统(单机版)>/仓库管理系统/biyesheji/src/tian/biye/Chaxung.java
package tian.biye;

import java.util.ArrayList;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.app.AlertDialog;


import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;

import android.widget.ListView;
import android.widget.SimpleAdapter;


/**
 * 查询供应商页面
 * 
 * @author 田志远
 * 
 */

public class Chaxung extends Activity {
	private ListView listview;

	String id[];
	String cname[];
	String pname[];
	String add[];
	String city[];
	String diqu[];
	String youbian[];
	String tel[];
	String chuanzhen[];
	String web[];

	SqlHelpdemo db;
	int i = 0;
	SQLiteDatabase sDatabase = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.shanchuk);
		setTitle("查询供应商");
		final AlertDialog.Builder builder = new AlertDialog.Builder(this);
		db = new SqlHelpdemo(getApplicationContext(), "store.db", null, 1);
		sDatabase = db.getWritableDatabase();
		listview = (ListView) findViewById(R.id.kehulist);
		List<Map<String, Object>> slist = new ArrayList<Map<String, Object>>();
		String selectStr = "select _id,comname,pername,addr,city,diqu,youbian,tel,chuangzhen,web  from gongys";
		Cursor cursor = sDatabase.rawQuery(selectStr, null);

		cursor.moveToFirst();

		int count = cursor.getCount();
		id = new String[count];
		cname = new String[count];
		pname= new String[count];
		add= new String[count];
		city= new String[count];
		diqu = new String[count];
		youbian= new String[count];
		tel= new String[count];
		chuanzhen= new String[count];
		web = new String[count];
		
		do {
			try {
				id[i] = cursor.getString(0);
				cname[i] = cursor.getString(1);
				pname[i] = cursor.getString(2);
				add[i] = cursor.getString(3);
				city[i] = cursor.getString(4);
				diqu[i] = cursor.getString(5);
				youbian[i] = cursor.getString(6);
				tel[i] = cursor.getString(7);
				chuanzhen[i] = cursor.getString(8);
				web[i] = cursor.getString(9);
				
				i++;

			} catch (Exception e) {
				// TODO: handle exception

			}

		} while (cursor.moveToNext());

		for (int i = 0; i < id.length; i++) {
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("id", id[i]);
			map.put("cname", cname[i]);
			map.put("pname", pname[i]);
			map.put("add", add[i]);
			map.put("city", city[i]);
			map.put("diqu", diqu[i]);
			map.put("youbian", youbian[i]);
			map.put("tel", tel[i]);
			map.put("chuanzhen", chuanzhen[i]);
			map.put("web", web[i]);
			slist.add(map);
		}
		SimpleAdapter simple = new SimpleAdapter(this, slist,
				R.layout.shanchukadpter1, new String[] { "id", "cname", "pname",
						"add" ,"city","diqu","youbian","tel","chuanzhen","web"}, new int[] { R.id.t1, R.id.t2, R.id.t3,
						R.id.t4, R.id.t5,R.id.t6,R.id.t7,R.id.t8,R.id.t9,R.id.t10,});
		listview.setAdapter(simple);
		
	}

}
最近下载更多
xueqian2568  LV1 2月3日
101589  LV1 2023年12月6日
1962940615  LV1 2023年8月25日
whdsichen  LV1 2023年6月5日
170011771  LV1 2023年5月31日
lmroman  LV8 2023年4月27日
tutou孙硕  LV1 2022年12月17日
17693282606  LV11 2022年9月16日
GZW012345  LV8 2022年6月3日
g010112g  LV6 2022年5月21日
最近浏览更多
caibos  LV4 4月8日
qq1357574774  LV2 3月28日
vluobo  LV1 3月19日
kaye7549317 3月18日
暂无贡献等级
1134116035 2月24日
暂无贡献等级
xueqian2568  LV1 2月3日
jiyun2021  LV9 1月26日
root111snkdnc  LV3 1月19日
FishYu11 1月19日
暂无贡献等级
Gin19960217  LV4 1月11日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友