自定义Tab3

class DoneActivity extends MyActivity implements FlushCaseCheck
{
    private Map<String, String> tabCategoryMap = new HashMap<String, String>();
   
    private List<Bean> myList = null;

    private ImageView loadNoDataPic = null;

    private OnClickListener listener = new OnClickListener()
    {
        public void onClick(View v)
        {
            DoneActivity.super.setPressedTab(v, R.drawable.tab_pressed, R.drawable.tab_unpressed);
            setPressedTab(v);
        }
    };
   
    private Handler Handler1 = new Handler()
    {
        public void handleMessage(Message msg)
        {
            super.handleMessage(msg);
            int what = msg.what;
            Object object = msg.obj;
            switch (what)
            {
                case FusionCode.RETURN_SOAPOBJECT:
                    if (object != null)
                    {
                        myList
                        MyAdapter myAdapter = new MyAdapter(DoneActivity.this);
                        myAdapter.setCTaskData(myList);
                        setListAdapter(myAdapter);
                       
                       
                        Bundle bundle = new Bundle();
                        bundle.putSerializable("ss", ss);
                        Intent intent = new Intent();
                        intent.putExtra("from", 2);
                        intent.putExtras(bundle);
                        intent.setAction("com.ss.dd.df.activity.ff");
                        startActivity(intent);
                    }
                    break;
                case FusionCode.NETWORK_TIMEOUT_ERROR:
                case FusionCode.NETWORK_ERROR:
                    break;
                case FusionCode.MSG_SSOID_FAILED:
                    break;
                default:
                    break;
            }
           
            loadFinish(R.drawable.no_data, myList);
        }
    };

    private void loadFinish(int noData, List<Bean> listBean)
    {
        if (listBean == null || listBean.isEmpty())
        {
            loadNoDataPic.setImageResource(noData);
            loadNoDataPic.setVisibility(View.VISIBLE);
        }
        else
        {
            loadNoDataPic.setVisibility(View.GONE);
        }
    }

    private void setPressedTab(View v)
    {
        flush(v);
    }

    private void flush(View v)
    {
        QueryThread qThread = new QueryThread(tabCategoryMap.get(v.getTag()), this);
        qThread.start();
    }

    public void flush(String category)
    {
        Bean mBean = new Bean();
        mBean.setSupervisionReplyFlag(category);
        querySuperviseRecListWService(mBean);
    }
   
    protected void onResume()
    {
        super.onResume();
       
        setPressedTab(super.prePressed);
    }
   
    public String setTopTitle()
    {
        return getString(R.string.checkrol);
    }
   
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
       
        String[] tabArray =
            new String[] {getText(R.string.checkrolno).toString(), getText(R.string.checkrolyes).toString(),
                getText(R.string.all).toString()};
        for (int i = 0; i < tabArray.length; i++)
        {
            tabCategoryMap.put(tabArray[i], String.valueOf(i));
        }
        builder(tabArray, listener);
       
        if (tabList == null || tabList.size() == 0)
        {
            return;
        }
       
        loadNoDataPic = (ImageView)findViewById(R.id.no_data_img);
       
        setPressedTab(tabList.get(0), R.drawable.tab_pressed, R.drawable.tab_unpressed);
        getListView().setOnItemClickListener(mOnItemClickListener);
        this.registerForContextMenu(getListView());
    }
}

interface FlushCaseCheck
{
    void flush(String category);
}

class QueryThread extends Thread
{
    private String category;
   
    private FlushCaseCheck flush;

    public QueryThread(String category, FlushCaseCheck flush)
    {
        this.category = category;
        this.flush = flush;
    }

    public void run()
    {
        flush.flush(category);
    }
   
}

你可能感兴趣的:(thread,bean)