Java 二维数组遍历赋值

        private String[][] HOMEPAGE_MAINMENU = { { "创业指导", "0" }, { "人才培养", "1" },
			{ "信息服务", "2" }, { "管理咨询", "3" }, { "法律维权", "4" }, { "市场开拓", "5" },
			{ "融资担保", "6" }, { "技术创新", "7" } };

        /**
	 * 加载数据
	 */
	private void loadData() {
		mAdapter = new MainGridViewAdapter(this);
		List dataList = new ArrayList();
		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);
	}

  

转载于:https://www.cnblogs.com/xiaoyao095/p/4432271.html

你可能感兴趣的:(java)