package com.chaoran.lx.thread;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.database.Cursor;
import android.os.Handler;
import android.os.Message;

import com.chaoran.db.DBManager;

public class LxMenuQueryThread implements Runnable {
	private DBManager dbManager;
	private List menuData;
	private Handler menuHandler;
	public LxMenuQueryThread(DBManager dbManager,Handler menuHandler,List menuData){
	  this.dbManager=dbManager;
	  this.menuData=menuData;
	  this.menuHandler=menuHandler;
	}
	@Override
	public void run() {
		Cursor cur=dbManager.query("select formlx as gn_no,formsm as mname from Sys_danjuformsoptions");
		ArrayList list=new ArrayList();
		HashMap<String, String> map;
		while(cur.moveToNext()){
			map=new HashMap<String, String>();
			map.put("gn_no", cur.getString(0));
			map.put("mname", cur.getString(1));
			list.add(map);
		}
		cur.close();
		menuData.addAll(list); 
		Message message = new Message();
		menuHandler.sendMessage(message);
	}

}
