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);
                    }
  • 相关阅读:
    HDU1548:A strange lift
    hdu1978_How many ways dfs+记忆化搜索
    HDU1518:Square(DFS)
    HDU ACM 1495 非常可乐(广搜BFS)
    HDU1372:Knight Moves(BFS)
    662_二叉树最大宽度
    590_N叉树的后序遍历
    一直在坚持
    动态链接库DLL的操作顺序
    最近木马的查杀方法/各类杀毒软件的使用
  • 原文地址:https://www.cnblogs.com/zhujiabin/p/5688750.html
Copyright © 2011-2022 走看看