首页>代码>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);
		
	}

}
最近下载更多
519506215  LV1 4月16日
dou220  LV1 2024年10月27日
hgy138339  LV1 2024年6月29日
xueqian2568  LV1 2024年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日
最近浏览更多
519506215  LV1 4月16日
zhao44413 2月21日
暂无贡献等级
gxh999810  LV1 2024年12月16日
dou220  LV1 2024年10月27日
微信网友_7143536520269824  LV1 2024年8月28日
Luckyaaa 2024年7月23日
暂无贡献等级
anjuw521  LV1 2024年7月10日
Newgate 2024年7月6日
暂无贡献等级
hgy138339  LV1 2024年6月29日
2636804923  LV6 2024年6月20日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友