Java 二维数组遍历赋值

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    private String[][] HOMEPAGE_MAINMENU = { { "创业指导", "0" }, { "人才培养", "1" },
        { "信息服务", "2" }, { "管理咨询", "3" }, { "法律维权", "4" }, { "市场开拓", "5" },
        { "融资担保", "6" }, { "技术创新", "7" } };
 
    /**
 * 加载数据
 */
private void loadData() {
    mAdapter = new MainGridViewAdapter(this);
    List<MainCatalogEntity> dataList = new ArrayList<MainCatalogEntity>();
    int length = HOMEPAGE_MAINMENU.length;
    for (int i = 0; i < length; i++) {
        MainCatalogEntity entity = new MainCatalogEntity();
        entity.setMenuName(HOMEPAGE_MAINMENU[i][0]);
        entity.setPicPath(HOMEPAGE_MAINMENU[i][1]);
        dataList.add(entity);
    }
    mAdapter.setData(dataList);
    maingridview.setAdapter(mAdapter);
}

  

posted @   宇少vlog  阅读(1082)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示