微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.widget.SimpleAdapter的实例源码

项目:MakiLite    文件ListPreferenceCompat.java   
@Override
public void setEntries(CharSequence[] entries) {
    super.setEntries(entries);
    if (mDialog != null) {
        ArrayList<HashMap<String,CharSequence>> listItems = new ArrayList<>();
        for (CharSequence entry : entries) {
            HashMap<String,CharSequence> map = new HashMap<>();
            map.put("item",entry);
            listItems.add(map);
        }
        mDialog.getListView().setAdapter(new SimpleAdapter(
                mContext,listItems,R.layout.select_dialog_singlechoice_material,new String[] {"item"},new int[]{android.R.id.text1}
        ));
    }
}
项目:stynico    文件QueryRMBQuotationByBank.java   
protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_exchange_rmb_quotation);
StatusBarUtil.setColor(this,getResources().getColor(R.color.colorPrimary));
       btnICBC = forceCast(findViewById(R.id.btnICBC));
       btnCMB = forceCast(findViewById(R.id.btnCMB));
       btnCCB = forceCast(findViewById(R.id.btnCCB));
       btnBOC = forceCast(findViewById(R.id.btnBOC));
       btnBCM = forceCast(findViewById(R.id.btnBCM));
       btnABC = forceCast(findViewById(R.id.btnABC));
       tvTittle = forceCast(findViewById(R.id.tvTittle));
       lvResult = forceCast(findViewById(R.id.lvResult));

       btnICBC.setonClickListener(this);
       btnCMB.setonClickListener(this);
       btnCCB.setonClickListener(this);
       btnBOC.setonClickListener(this);
       btnBCM.setonClickListener(this);
       btnABC.setonClickListener(this);

       //init data
       adapter = new SimpleAdapter(this,dataList,R.layout.view_exchange_rmb_quotation_item,new String[]{"bankName","bank","currencyName","currencyCode","fBuyPri","mBuyPri","fSellPri","mSellPri","bankConversionPri","date","time"},new int[]{R.id.tvBankName,R.id.tvBankCode,R.id.tvCurrencyName,R.id.tvCurrencyCode,R.id.tvFBuyPri,R.id.tvMBuyPri,R.id.tvFSellPri,R.id.tvMSellPri,R.id.tvBankConversionPri,R.id.tvDate,R.id.tvTime});
       lvResult.setAdapter(adapter);
   }
项目:stynico    文件LotteryAPIActivity.java   
protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_lottery);
StatusBarUtil.setColor(this,getResources().getColor(R.color.colorPrimary));
       etPeriod = forceCast(findViewById(R.id.etPeriod));
       tvDateTime = forceCast(findViewById(R.id.tvDateTime));
       tvName = forceCast(findViewById(R.id.tvName));
       tvSales = forceCast(findViewById(R.id.tvSales));
       tvPool = forceCast(findViewById(R.id.tvPool));
       tvPeriod = forceCast(findViewById(R.id.tvPeriod));
       tvLotteryNumber = forceCast(findViewById(R.id.tvLotteryNumber));

       GridView gvLotteryList = forceCast(findViewById(R.id.gvLotteryList));
       ListView lvLotteryResult = forceCast(findViewById(R.id.lvLotteryAward));
       gvLotteryList.setonItemClickListener(this);

       //init data
       updateLotteryInfo(null,null,null);

       lotteryTypeList = new ArrayList<HashMap<String,Object>>();
       lotteryTypelistadapter = new SimpleAdapter(this,lotteryTypeList,android.R.layout.simple_list_item_1,new String[]{"name"},new int[]{android.R.id.text1});
       gvLotteryList.setAdapter(lotteryTypelistadapter);

       lotteryResultList = new ArrayList<HashMap<String,Object>>();
       lotteryResultAdapter = new LotteryResultAdapter(this,lotteryResultList);
       lvLotteryResult.setAdapter(lotteryResultAdapter);

       //获取彩种列表
       ((Lottery) forceCast(MobAPI.getAPI(Lottery.NAME))).queryLotteryList(LotteryAPIActivity.this);
   }
项目:yphoto    文件LocationSearchActivity.java   
private void init() {
    ListView search_list = (ListView) findViewById(R.id.search_list);

    SimpleAdapter adapter = new SimpleAdapter(this,getLocationList(),R.layout.item_location_favorites,new String[]{"name","detail","item_type"},new int[]{R.id.location_name,R.id.location_detail,R.id.item_type_icon});
    search_list.setAdapter(adapter);

    /*
    search_Box = (EditText) findViewById(R.id.search_Box);
    search_Box.addTextChangedListener(this);

    clear_progress_btn = (ImageView) findViewById(R.id.clear_progress_icon);
    clear_progress_btn.setonClickListener(this);
    clear_progress_btn.setimageDrawable(null);

    mPlaceAPI = new PlaceOpenAPI(this,WeiboData.APP_KEY,WeiboData.readAccesstoken(this));
    */
}
项目:Virtualview-Android    文件ScriptListActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(android.R.layout.list_content);
    List<Map<String,String>> list = new ArrayList<Map<String,String>>();
    HashMap<String,String> ntext = new HashMap<String,String>();
    ntext.put("name","this.name = (data.time > data.id) && (data.time >= 3)");
    list.add(ntext);
    HashMap<String,String> page = new HashMap<String,String>();
    page.put("name","PageScrollScript");
    page.put("class",ComponentActivity.class.getName());
    page.put("data","component_demo/page_item.json");
    list.add(page);
    HashMap<String,String> click = new HashMap<String,String>();
    click.put("name","ClickScript");
    click.put("class",ComponentActivity.class.getName());
    list.add(click);
    listadapter listadapter = new SimpleAdapter(this,list,new int[]{android.R.id.text1});
    setlistadapter(listadapter);
}
项目:HiBangClient    文件UserSettingFragment.java   
/**
 * 设置第一列数据
 */
private SimpleAdapter getSimpleAdapter_1() {
    listData = new ArrayList<Map<String,String>>();

    Map<String,String> map = new HashMap<String,String>();
    map.put("text","账户设置");
    listData.add(map);

    map = new HashMap<String,"个人资料");
    listData.add(map);

    return new SimpleAdapter(mContext,listData,R.layout.setting_list_item,new String[] { "text" },new int[] { R.id.tv_list_item });

}
项目:HiBangClient    文件UserSettingFragment.java   
/**
 * 设置第二列数据
 */
private SimpleAdapter getSimpleAdapter_2() {
    listData2 = new ArrayList<Map<String,"屏蔽发现");
    listData2.add(map);

    map = new HashMap<String,"会员介绍");
    listData2.add(map);

    map = new HashMap<String,"意见反馈");
    listData2.add(map);

    map = new HashMap<String,"小嗨帮助");
    listData2.add(map);


    return new SimpleAdapter(mContext,listData2,new int[] { R.id.tv_list_item });

}
项目:HiBangClient    文件EditProvinceActivity.java   
/**
     * 设置第一列数据
     */
    private SimpleAdapter getSimpleAdapter_1() {
        listData = new ArrayList<Map<String,String>>();

        mProvinceArr = this.getResources().getStringArray(R.array.province);

        for(int i = 0;i < mProvinceArr.length;i++)
        {
            Map<String,String>();
            map.put("text",mProvinceArr[i]);
            listData.add(map);
        }

//      Map<String,String>();
//      map.put("text","账户设置");
//      listData.add(map);
//
//      map = new HashMap<String,"个人资料");
//      listData.add(map);

        return new SimpleAdapter(EditProvinceActivity.this,R.layout.province_list_item,new int[] { R.id.tv_province_list_item });

    }
项目:HiBangClient    文件RegProvinceActivity.java   
/**
     * 设置第一列数据
     */
    private SimpleAdapter getSimpleAdapter_1() {
        listData = new ArrayList<Map<String,"个人资料");
//      listData.add(map);

        return new SimpleAdapter(RegProvinceActivity.this,new int[] { R.id.tv_province_list_item });

    }
项目:grafika    文件MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // One-time singleton initialization; requires activity context to get file location.
    ContentManager.initialize(this);

    setlistadapter(new SimpleAdapter(this,createActivityList(),android.R.layout.two_line_list_item,new String[] { TITLE,DESCRIPTION },new int[] { android.R.id.text1,android.R.id.text2 } ));

    ContentManager cm = ContentManager.getInstance();
    if (!cm.isContentCreated(this)) {
        ContentManager.getInstance().createall(this);
    }

    ActivityCompat.requestPermissions(this,PERMISSIONS,1);
}
项目:AndroidUiKit    文件HomeActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        String path = intent.getStringExtra(APP_PATH);

        if (path == null) {
            path = "";
        }

        setlistadapter(new SimpleAdapter(this,getData(path),new String[] { "title" },new int[] { android.R.id.text1 }));
        getListView().setTextFilterEnabled(true);

//        String testStr = "<sss > <sss> <贷款及覅> dfsh <a > ksdjfk </a>";
//        HtmlFormater.stripHtmlTagByJsoup(testStr);

//        NumberFormat nf = NumberFormat.getPercentInstance();
//        try {
//            nf.parse("0");
//        } catch (ParseException e) {
//            e.printstacktrace();
//        }
    }
项目:Huochexing12306    文件BuyTicketInfoFragment.java   
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_buy_ticket_info,null);
    lvInfos = (ListView) v.findViewById(R.id.buyTicketInfo_lvInfos);
    MyDatabase myDB = new MyDatabase(this.getActivity());
    mAdapter= new SimpleAdapter(this.getActivity(),mLstDatas,R.layout.item_buy_ticket_info,new String[]{MyDatabase.KEY,MyDatabase.VALUE},new int[]{R.id.item_buy_ticket_info_tvQuestion,R.id.item_buy_ticket_info_tvAnswer}
            );
    lvInfos.setAdapter(mAdapter);
    myDB.closeDB();
    notifyAdapterDataChanged(myDB.getTicketInfos(0));
    MyUtils.setListViewHeightBasedOnChildren(lvInfos);  //设置ListView全部显示
    ViewGroup.LayoutParams params = lvInfos.getLayoutParams();

    params.height += 3000;   //方法不太准,人为校正高度
    lvInfos.setLayoutParams(params);
    sv1 = (ScrollView)v.findViewById(R.id.buyTicketInfo_sv1);
    sv1.smoothScrollTo(0,20);
    return v;
}
项目:Huochexing12306    文件EditimageAty.java   
private void initViews() {
    GridView gvIcons = (GridView) findViewById(R.id.icons);
    SimpleAdapter adapter = new SimpleAdapter(this,getIcons(),R.layout.item_editimage,new String[] { "item","resId" },new int[] { R.id.item_editimage_ivIcon,R.id.item_editimaeg_tvResId });
    gvIcons.setAdapter(adapter);
    gvIcons.setonItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0,View arg1,int arg2,long arg3) {
            TextView tv1 = (TextView) arg1
                    .findViewById(R.id.item_editimaeg_tvResId);
            int resId = Integer.valueOf(tv1.getText().toString());
            Intent intent = new Intent();
            intent.putExtra(RESULT,resId);
            EditimageAty.this.setResult(EditimageAty.this.getIntent()
                    .getIntExtra(C_RESULT_CODE,0),intent);
            EditimageAty.this.finish();
        }
    });
}
项目:oneKey2Alarm    文件contacts.java   
public void intint(){
    db.open(); 
       Cursor c = db.getAllContacts();
       if (c.movetoFirst()) 
       { 
           do {
            id = c.getString(c.getColumnIndex("_id"));
            name = c.getString(c.getColumnIndex("name"));
               number = c.getString(c.getColumnIndex("phonenum"));
            Map<String,Object> map = new HashMap<String,Object>();
            map.put("contacts_name",name);
            map.put("contacts_num",number);
                dataList.add(map);
                simpleadapter = new SimpleAdapter(this,R.layout.contact_text,new String[]{"contacts_name","contacts_num"},new int[]{R.id.contacts_name,R.id.contacts_num});
            listView.setAdapter(simpleadapter); 
              // displayContact(c); 

           }while (c.movetoNext()); 
           db.close();
       } 
}
项目:AndroidInstantVideo    文件MainActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Loggers.DEBUG = true;
    CrashHandler.init(getApplicationContext());
    getPermission();

    Intent intent = getIntent();
    String path = intent.getStringExtra(INTENT_PATH);

    if (path == null) {
        path = "";
    }

    /*** The "title" is the "key" in "Map" ***/
    setlistadapter(new SimpleAdapter(this,new int[] { android.R.id.text1 }));

    //If you can get the keyboard,you can type to search the items of the list
    getListView().setTextFilterEnabled(true);

}
项目:PretendSharing_Xposed    文件AppInfoActivity.java   
private void refreshApps() {
    // (re)load the list of apps in the background
    final PackageManager pm = getPackageManager();
    List<PackageInfo> pkgs = getPackageManager().getInstalledPackages(0);
    List<Map<String,Object>> returnBackList = new ArrayList<Map<String,Object>>();
    for(PackageInfo i:pkgs){
        if((i.applicationInfo.flags & ApplicationInfo.FLAG_SYstem) > 0 )
            continue; //跳过系统应用
        Map<String,Object>();
        map.put("title",String.valueOf(i.applicationInfo.loadLabel(pm)));
        map.put("info",String.valueOf(i.applicationInfo.packageName));
        map.put("img",i.applicationInfo.loadIcon(pm));
        returnBackList.add(map);
    }
    SimpleAdapter adapter = new SimpleAdapter(this,returnBackList,R.layout.vlist,new String[]{"title","info","img"},new int[]{R.id.title,R.id.info,R.id.img});
    list.setAdapter(adapter);
}
项目:SimpleMarkdown    文件ExplorerActivity.java   
private void updateListView(File filesDir) {
    setTitle(filesDir.getName());
    filePath = filesDir.getAbsolutePath();
    fileHandler.post(() -> {
        List<HashMap<String,Object>> files = loadFiles(filesDir);

        listView.setAdapter(new SimpleAdapter(
                this,files,new int[]{android.R.id.text1}
        ));

        listView.setonItemClickListener((parent,view,position,id) -> {
            File clickedFile = (File) files.get(position).get("file");
            if (clickedFile.isFile()) {
                handleFileClick(clickedFile);
            } else if (clickedFile.isDirectory()) {
                updateListView(clickedFile);
            }
        });
    });
}
项目:Android-Kode-POS    文件PropinsiActivity.java   
@Override
protected void onPostExecute(Void result) {
    super.onPostExecute(result);
    // dismiss the progress dialog
    if (pDialog.isShowing())
        pDialog.dismiss();

    // Sorting a-z
    Collections.sort(posList,new Comparator<HashMap< String,String >>() {

        @Override
        public int compare(HashMap<String,String> lhs,HashMap<String,String> rhs) {
            return lhs.get("name").compareto(rhs.get("name"));
        }
    });

    // Updating parsed JSON data into ListView
    listadapter adapter = new SimpleAdapter(
            PropinsiActivity.this,posList,R.layout.list_daerah,new int[]{R.id.name});

    lv.setAdapter(adapter);
}
项目:Android-Kode-POS    文件KotaActivity.java   
@Override
protected void onPostExecute(Void result) {
    super.onPostExecute(result);
    // dismiss the progress dialog
    if (pDialog.isShowing())
        pDialog.dismiss();

    // Sorting a-z
    Collections.sort(posList,String> rhs) {
            return lhs.get("kecamatan").compareto(rhs.get("kecamatan"));
        }
    });

    // Updating parsed JSON data into ListView
    listadapter adapter = new SimpleAdapter(
            KotaActivity.this,R.layout.list_pos,new String[]{"kecamatan","kelurahan","kodepos"},new int[]{R.id.kecamatan,R.id.kelurahan,R.id.kodepos});

    lv.setAdapter(adapter);
}
项目:Android-Kode-POS    文件MainActivity.java   
@Override
protected void onPostExecute(Void result) {
    super.onPostExecute(result);
    // dismiss the progress dialog
    if (pDialog.isShowing())
        pDialog.dismiss();

    // Sorting a-z
    Collections.sort(posList,String> rhs) {
            return lhs.get("name").compareto(rhs.get("name"));
        }
    });

    // Updating parsed JSON data into ListView
    listadapter adapter = new SimpleAdapter(
            MainActivity.this,new int[]{R.id.name});

    lv.setAdapter(adapter);
}
项目:Toodoo    文件ToodooNote.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    // Todo Auto-generated method stub
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.label_dialog);
    labelList = (ListView) findViewById(R.id.label_list);
    cancel = (Button) findViewById(R.id.cancel);
    // ListView
    SimpleAdapter adapter = new SimpleAdapter(context,getLabelList(),R.layout.label_list_item,new String[]{"label_img","label_value"},new int[]{
            R.id.label_img,R.id.label_value});
    labelList.setAdapter(adapter);
    //ListView
    labelList
            .setonItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> arg0,int position,long arg3) {
                    HashMap<String,Object> label = getLabelList().get(position);
                    selectedLabel = (String) label.get("label_value");

                    ToodooOptionsModel ToodooOptionsModel = toodooOptionsList.get(0);
                    ToodooOptionsModel.setoptionValue(selectedLabel);
                    mAdapter.notifyDataSetChanged();
                    labelDialog.dismiss();
                }
            });

    cancel.setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            labelDialog.dismiss();
        }
    });
}
项目:Android-fitness    文件NutrientAdapter.java   
public SimpleAdapter getAdapter(Context context,String nutrient) {
    ArrayList<HashMap<String,Object>> listItem = new ArrayList<HashMap<String,Object>>();
    String[] s = nutrient.split(";");
    for (int i = 0; i < s.length; i++) {
        HashMap<String,Object>();
        String[] s1 = s[i].split(":");
        if (s1.length == 1) // ��ֹ����ĸ�ʽ��û��":"����split�����ַ�������
            return null;
        String name = s1[0];
        String content = s1[1];
        String comment = "";// Integer.parseInt(s1[1]);
        map.put("nutrient_name",name);
        map.put("nutrient_content",content);
        map.put("nutrient_comment",comment);
        listItem.add(map);
    }
    SimpleAdapter mSimpleAdapter = new SimpleAdapter(context,listItem,R.layout.food_nutrient_list_item,new String[] { "nutrient_name","nutrient_content","nutrient_comment" },new int[] { R.id.nutrient_name,R.id.nutrient_content,R.id.nutrient_comment });

    return mSimpleAdapter;
}
项目:AndroidCollection    文件MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String path = intent.getStringExtra("com.example.ku.collection.Path");

    if (path == null) {
        path = "";
    }

    setlistadapter(new SimpleAdapter(this,new int[] { android.R.id.text1 }));
    getListView().setTextFilterEnabled(true);
    mHandler.sendEmptyMessageDelayed(1,200);
    mHandler.removeMessages(1);

}
项目:Animations    文件LauncherActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ArrayList<Map<String,Object>> list = new ArrayList<>(DATA.length);
    for (Class clz : DATA) {
        Map<String,Object> map = new HashMap<>(1);
        map.put("Title",clz.getSimpleName());
        map.put("Class",clz);
        list.add(map);
    }

    ListView listView = new ListView(this);
    listView.setAdapter(new SimpleAdapter(this,new String[]{"Title"},new int[]{android.R.id.text1}));
    listView.setonItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        @SuppressWarnings("unchecked")
        public void onItemClick(AdapterView<?> adapterView,View view,int i,long l) {
            Map<String,Object> data = (Map<String,Object>)adapterView.getItemAtPosition(i);
            startActivity(new Intent(LauncherActivity.this,(Class)data.get("Class")));
        }
    });
    setContentView(listView);
}
项目:Treebolic    文件ServicesActivity.java   
@Override
protected void onCreate(final Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    // layout
    setContentView(R.layout.activity_services);

    // toolbar
    final Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    // set up the action bar
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null)
    {
        actionBar.setdisplayOptions(ActionBar.disPLAY_USE_logo | ActionBar.disPLAY_SHOW_TITLE | ActionBar.disPLAY_SHOW_HOME | ActionBar.disPLAY_HOME_AS_UP);
    }

    // adapter
    final SimpleAdapter adapter = Services.makeAdapter(this,R.layout.item_services,from,to,true);
    final ListView listView = findViewById(R.id.services);
    listView.setAdapter(adapter);
}
项目:xbot_head    文件YoutuIpPreference.java   
public void showHistoryList() {

        for (String str : historyArr) {
            if (str != null) {
                Map<String,String> map = new HashMap<>();
                map.put("textViewIp",str);
                historyList.add(map);
            }

        }
        simpleAdapter = new SimpleAdapter(getContext(),historyList,android.R.layout.simple_dropdown_item_1line,new String[]{"textViewIp"},new int[]{android.R.id.text1});

        listView.setAdapter(simpleAdapter);
    }
项目:xbot_head    文件RosIpPreference.java   
public void showHistoryList() {

        for (String str : historyArr) {
            if (str != null) {
                Map<String,new int[]{android.R.id.text1});

        listView.setAdapter(simpleAdapter);
    }
项目:ReadPhoneContacts    文件MainActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        listView = (ListView) findViewById(R.id.lv_list);
        //设置适配器
        //SimpleAdapter的参数说明
//        第一个参数 表示访问整个android应用程序接口,基本上所有的组件都需要
//        第二个参数表示生成一个Map(String,Object)列表选项
//        第三个参数表示界面布局的id  表示该文件作为列表项的组件
//        第四个参数表示该Map对象的哪些key对应value来生成列表项
//        第五个参数表示来填充的组件 Map对象key对应的资源一依次填充组件 顺序有对应关系
        listView.setAdapter(new SimpleAdapter(this,readContact(),R.layout.contact_list_item,"phone"},new int[]{R.id.tv_name,R.id.tv_phone}));


    }
项目:GroupingMessages    文件ChangeCategoryActivity.java   
private void setCategoryListView() {
    String[] from = {
            DatabaseContract.Category._ID,DatabaseContract.Category.KEY_NAME
    };
    int[] to = {
            R.id.id_category_textview,R.id.name_category_textview
    };

    SimpleAdapter arrayAdapter = new SimpleAdapter(
            this,categories,R.layout.choose_category_list_item,to
    );

    // DataBind ListView with items from ArrayAdapter
    categoryListView.setAdapter(arrayAdapter);
}
项目:APK    文件ActivityLoader.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addItem("[ Launch SampleActivity ]",null);
    addItem("[ Default.apk ]",null);
    try {
        AssetManager asset = getAssets();
        for (String s : asset.list("apks")) {
            addItem(s,"apks/" + s);
        }
    } catch (Exception e) {
    }

    SimpleAdapter adapter = new SimpleAdapter(this,data,new int[] { android.R.id.text1 });
    setlistadapter(adapter);
}
项目:APK    文件ListApkFragment.java   
@Override
public void onViewCreated(View view,Bundle savedInstanceState) {
    super.onViewCreated(view,savedInstanceState);

    try {
        AssetManager asset = getActivity().getAssets();
        for (String s : asset.list("apks")) {
            addItem(s,"apks/" + s);
        }
    } catch (Exception e) {
    }

    SimpleAdapter adapter = new SimpleAdapter(getActivity(),new int[] { android.R.id.text1 });
    setlistadapter(adapter);
}
项目:android-openGL-canvas    文件MainActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    CrashHandler.init(getApplicationContext());
    Loggers.DEBUG = true;
    getPermission();

    Intent intent = getIntent();
    String path = intent.getStringExtra(INTENT_PATH);

    if (path == null) {
        path = "";
    }

    /*** The "title" is the "key" in "Map" ***/
    setlistadapter(new SimpleAdapter(this,you can type to search the items of the list
    getListView().setTextFilterEnabled(true);

}
项目:wifon-mini    文件NearbyListFragment.java   
@Override
public void onNearbyPeers(List<NearbyUser> nearbyPeers) {
    List<Map<String,String>> list = new ArrayList<>();
    for (NearbyUser nearbyUser : nearbyPeers) {
        if (nearbyUser.username != null) {
            HashMap<String,String> map = new HashMap<>();
            map.put("username",nearbyUser.username);
            map.put("crocoId",nearbyUser.crocoId);
            list.add(map);
        }
    }
    String[] from = { "username","crocoId" };
    int[] to = { android.R.id.text1,android.R.id.text2 };
    SimpleAdapter adapter = new SimpleAdapter(getContext(),android.R.layout.simple_list_item_2,to);
    // this is a terrible way how to update items
    setlistadapter(adapter);
}
项目:Ymir    文件EntityDetailFragment.java   
@Override
void refreshData(IEntityRecord entityRecord) {
    if (entityRecord == null) {
        return;
    }

    //Popula os campos adicionais.
    List<Map<String,CharSequence>> data = new ArrayList<>();
    for (IDetailFieldMapping fieldMapping : fieldsMappings) {
        String label = fieldMapping.getLabel();
        //Formata o valor utilizandos a máscara definida para o campo,de acordo com o seu tipo.
        CharSequence value = attributesFormatter.formatAttributeValuetoText(entityRecord,fieldMapping.getAttribute());

        Map<String,CharSequence> dataItem = new HashMap<>();
        dataItem.put(DetailFieldAdapter.LABEL_COLUMN,label);
        dataItem.put(DetailFieldAdapter.VALUE_COLUMN,value);
        data.add(dataItem);
    }

    SimpleAdapter adapter = new DetailFieldAdapter(context,fieldsMappings);
    fieldsList.setAdapter(adapter);
}
项目:Upkeep    文件PreferencesActivity.java   
@Override
public boolean onPreferenceClick(final Preference preference) {
    final Builder b = new Builder(ctx);
    final int l = NOTIFICAION_STR.length;
    final String[] cols = new String[]{"icon","text"};
    final ArrayList<HashMap<String,Object>> rows
            = new ArrayList<>();
    for (int i = 0; i < l; i++) {
        final HashMap<String,Object> m = new HashMap<>(2);
        m.put(cols[0],NOTIFICAION_IMG[i]);
        m.put(cols[1],ctx.getString(NOTIFICAION_STR[i]));
        rows.add(m);
    }
    b.setAdapter(new SimpleAdapter(ctx,rows,R.layout.notification_icons_item,cols,new int[]{android.R.id.icon,android.R.id.text1}),new DialogInterface.OnClickListener() {
                @Override
                public void onClick(final DialogInterface dialog,final int which) {
                    preference.getEditor().putInt(preference.getKey(),which).commit();
                }
            });
    b.setNegativeButton(android.R.string.cancel,null);
    b.show();
    return true;
}
项目:Upkeep    文件PreferencesActivity.java   
@Override
public boolean onPreferenceClick(final Preference preference) {
    final Builder b = new Builder(ctx);
    final int l = BUBBLES_STR.length;
    final String[] cols = new String[]{"icon",BUBBLES_IMG[i]);
        m.put(cols[1],ctx.getString(BUBBLES_STR[i]));
        rows.add(m);
    }
    b.setAdapter(new SimpleAdapter(ctx,R.layout.bubbles_item,new int[]{
                    android.R.id.icon,null);
    b.show();
    return true;
}
项目:CountDownTask    文件LauncherActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ListView listView = new ListView(this);
    setContentView(listView);

    Log.d(TAG,TAG + " task id: " + getTaskId());

    Intent intent = getIntent();
    String path = intent.getStringExtra(getPackageName() + ".Path");

    if (path == null) {
        path = "";
    }

    listView.setAdapter(new SimpleAdapter(this,new String[]{"title"},new int[]{android.R.id.text1}));
    listView.setTextFilterEnabled(true);
    listView.setonItemClickListener(this);
}
项目:protrip    文件InfoActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_info);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_info);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(getString(R.string.title_titlebar_info));
    getSupportActionBar().setdisplayHomeAsUpEnabled(true);


    initList();
    ListView lv = (ListView) findViewById(R.id.list_info);
    SimpleAdapter simpleAdpt = new SimpleAdapter(this,infoList,new String[] {"info"},new int[] {android.R.id.text1});

    lv.setAdapter(simpleAdpt);
    lv.setonItemClickListener(this);
    lv.setSelection(0);

    //views
    TextView tvVersionName=(TextView)findViewById(R.id.label_version);
    tvVersionName.setText("v"+BuildConfig.VERSION_NAME);
}
项目:xDrip    文件AlertList.java   
void FillLists() {
    // We use a - sign to tell that this text should be stiked through
    SimpleAdapter.ViewBinder vb = new SimpleAdapter.ViewBinder() {
        public boolean setViewValue(View view,Object data,String textRepresentation) {
            TextView tv = (TextView) view;
            tv.setText(textRepresentation.substring(1));
            if (textRepresentation.substring(0,1).equals("-")) {
                tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
            }
            return true;
        }
    };

    ArrayList<HashMap<String,String>> FeedList;
    FeedList = createalertsMap(false);
    SimpleAdapter simpleAdapterLow = new SimpleAdapter(this,FeedList,R.layout.row_alerts,new String[]{"alertName","alertThreshold","alertTime","alertMp3File","alertOverrideSilenceMode"},new int[]{R.id.alertName,R.id.alertThreshold,R.id.alertTime,R.id.alertMp3File,R.id.alertOverrideSilent});
    simpleAdapterLow.setViewBinder(vb);

    listViewLow.setAdapter(simpleAdapterLow);

    FeedList = createalertsMap(true);
    SimpleAdapter simpleAdapterHigh = new SimpleAdapter(this,R.id.alertOverrideSilent});
    simpleAdapterHigh.setViewBinder(vb);
    listViewHigh.setAdapter(simpleAdapterHigh);
}
项目:xDrip-plus    文件AlertList.java   
void FillLists() {
    // We use a - sign to tell that this text should be stiked through
    SimpleAdapter.ViewBinder vb = new SimpleAdapter.ViewBinder() {
        public boolean setViewValue(View view,R.id.alertOverrideSilent});
    simpleAdapterHigh.setViewBinder(vb);
    listViewHigh.setAdapter(simpleAdapterHigh);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。