【问题标题】:how to group array lists into one如何将数组列表组合成一个
【发布时间】:2014-06-04 00:25:06
【问题描述】:

如何将这两个数组列表合并为一个数组列表,以便它在我的 arrayAdapter 中仍然有效。我不记得该怎么做。

public class MyArrayAdapter extends ArrayAdapter<String>{
        Context context;
        ArrayList<String>mtitle;
        ArrayList<String>mdesc;

        public MyArrayAdapter(Context c, ArrayList<String>title, ArrayList<String>desc) {
            super(c, R.layout.single_row, R.id.viewtitle, title);

...

【问题讨论】:

    标签: java android arrays android-arrayadapter


    【解决方案1】:

    使用java被类型数组列表。 喜欢:-

    public class JBContacts {
        public String strID = "";
        public String strTitle = "";
        public String getStrID() {
            return strID;
        }
        public void setStrID(String strID) {
            this.strID = strID;
        }
        public String getStrTitle() {
            return strTitle;
        }
        public void setStrTitle(String strTitle) {
            this.strTitle = strTitle;
        }
    
    }
    
    ArrayList<JBContacts> mArrayListContacts;
    JBContacts mJbContacts;
    
    mArrayListContacts = new ArrayList<JBContacts>();
                    mJbContacts = new JBContacts();
    
                            strId = mJsonObjectContacts.getString(Constants.TAG_ID);
                            strTitle = mJsonObjectContacts
                                    .getString(Constants.TAG_TITLE);
                            mJbContacts.setStrTitle(strTitle);
    

    【讨论】:

      猜你喜欢
      • 2020-10-28
      • 1970-01-01
      • 2022-08-18
      • 2019-07-03
      • 2019-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-15
      相关资源
      最近更新 更多