zoukankan      html  css  js  c++  java
  • Android Bitmap是不能比较的,这样做是错误的

    代码1:

           Bitmap dir = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_search_list_img);
                    Bitmap doc = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_word_file);
                    Bitmap xls = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_excel_file);
                    Bitmap ppt = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_ppt_file);
                    Bitmap jpg = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_img_file);
                    Bitmap zip = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_zip_file);
                    Bitmap voc = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_none_file);
                    Bitmap none = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_none_file);
                    if(dir.equals(mMySkydriveList.get(i).getNetdiscListImgs())){
                        tmpObj.put("ext", "1");
                    }else  if(doc.equals(mMySkydriveList.get(i).getNetdiscListImgs())){
                        tmpObj.put("ext", "2");
                    }else  if(xls.equals(mMySkydriveList.get(i).getNetdiscListImgs())){
                        tmpObj.put("ext", "3");
                    }else  if(ppt.equals(mMySkydriveList.get(i).getNetdiscListImgs())){
                        tmpObj.put("ext", "4");
                    }else  if(jpg.equals(mMySkydriveList.get(i).getNetdiscListImgs())){
                        tmpObj.put("ext", "5");
                    }else  if(zip.equals(mMySkydriveList.get(i).getNetdiscListImgs())){
                        tmpObj.put("ext", "6");
                    }else  if(voc.equals(mMySkydriveList.get(i).getNetdiscListImgs())){
                        tmpObj.put("ext", "7");
                    }else  if(none.equals(mMySkydriveList.get(i).getNetdiscListImgs())){
                        tmpObj.put("ext", "8");
                    }

    代码2:

       /**
                     * 增加文件夹图片
                     * */
                    if (mExt.equals("1")) {
                        Bitmap dir = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_search_list_img);
                        mMySkydriveItem.setNetdiscListImgs(dir);
                    } else if (mExt.equals("2")) {
                        Bitmap doc = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_word_file);
                        mMySkydriveItem.setNetdiscListImgs(doc);
                    } else if (mExt.equals("3")) {
                        Bitmap xls = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_excel_file);
                        mMySkydriveItem.setNetdiscListImgs(xls);
                    } else if (mExt.equals("4")) {
                        Bitmap ppt = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_ppt_file);
                        mMySkydriveItem.setNetdiscListImgs(ppt);
                    } else if (mExt.equals("5")) {
                        Bitmap jpg = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_img_file);
                        mMySkydriveItem.setNetdiscListImgs(jpg);
                    } else if (mExt.equals("6")) {
                        Bitmap zip = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_zip_file);
                        mMySkydriveItem.setNetdiscListImgs(zip);
                    } else if (mExt.equals("7")) {
                        Bitmap voc = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_none_file);
                        mMySkydriveItem.setNetdiscListImgs(voc);
                    } else if (mExt.equals("0")) {
                        Bitmap none = BitmapFactory.decodeResource(context.getResources(), R.drawable.netdisc_none_file);
                        mMySkydriveItem.setNetdiscListImgs(none);
                    }
  • 相关阅读:
    Appium+python自动化3-启动淘宝app
    Appium+python自动化2-环境搭建(下)
    Appium+python自动化1-环境搭建(上)
    postman提取返回值
    Android studio(AS)的下载和安装
    monkey的安装和配置
    配置自己的CentOS7服务器
    mac-homebrew安装太慢
    vue.js中祖孙通信之provide与inject
    nginx location 以及 proxy_pass 的几种情况 以/结尾的问题
  • 原文地址:https://www.cnblogs.com/zhujiabin/p/5688750.html
Copyright © 2011-2022 走看看