zoukankan      html  css  js  c++  java
  • Button switch..case 语句监听按钮点击的方法。。下面这方法好。

    public void onClick(View v) {
            switch (v.getId()) {
            case R.id.btnEditOk: {           //点击编辑完成 ,它就调到 ShareActvity页面去了
       if(NullCheckUtil.isNotNull(edit_text.getText().toString())){
                String cotent=edit_text.getText().toString();
                try {
                    share2weibo(cotent, imagePath);
                    this.finish();
                } catch (WeiboException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
       }else{
            Toast.makeText(this, "说点什么把...", Toast.LENGTH_SHORT);
       }
           break;
            }case R.id.btnSelectImage:{
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult( intent, 1);
                break;
            }
            }
    
        }
  • 相关阅读:
    ORM框架
    优酷项目1
    新年第一天
    前端第十天
    前端第九天
    前端第八天
    前端第七天
    前端第六天
    前端第五天
    月亮与六便士
  • 原文地址:https://www.cnblogs.com/firecode/p/2685530.html
Copyright © 2011-2022 走看看