JAVA Android 所有省,市級聯名稱

2021-07-05 15:23:44 字數 1626 閱讀 4784

在android客戶端做使用者註冊的時候,通常會讓使用者選擇所在的省,市.一般情況下省,市的劃分是不變動的.不需要從服務端獲取資料,需要在本地把資料寫死。

這時問題出現了,全中國有34個省,幾百個市。如果手動錄入的話那就是災難。我試過錄入的三個省份就沒有耐心了,再者說把大把的時間花費在打字上絕對是浪費生命。

那麼福利來了,下面這段**是我從我們客戶端貼上過來的乙個幫助類,裡面記錄了我們所有的省市,你只需要貼上到自己工程裡就可以使用了。

需要說明的是,我把所有的省市儲存到乙個hashmap中,根據省的名稱就可以獲取該省的所有市的名稱。

public class shengshihelper

public void setmap());

map.put("上海", new string );

map.put("雲南省", new string );

map.put("內蒙古自治區", new string );

map.put("吉林省", new string );

map.put("四川省", new string );

map.put("天津", new string );

map.put("寧夏回族自治區", new string );

map.put("安徽省", new string );

map.put("山東省", new string );

map.put("山西省", new string );

map.put("廣東省", new string );

map.put("廣西省", new string );

map.put("新疆自治區", new string );

map.put("江蘇省", new string );

map.put("江西省", new string );

map.put("河北省", new string );

map.put("河南省", new string );

map.put("浙江省", new string );

map.put("海南省", new string );

map.put("湖北省", new string );

map.put("湖南省", new string );

map.put("澳門特別行政區", new string );

map.put("甘肅省", new string );

map.put("福建省", new string );

map.put("**自治區", new string );

map.put("貴州省", new string );

map.put("遼寧省", new string );

map.put("重慶", new string );

map.put("陝西省", new string );

map.put("青海省", new string );

map.put("台灣", new string );

map.put("香港特別行政區", new string );

map.put("黑龍江省", new string );

}public string getshifromsheng(string sheng)

}

xml格式 全國所有省市的資訊

找了好久才找見 拿來分享 北京下面有個城市是日本 哈哈 開個玩笑哈 選擇城市 東城區西城區 崇文區宣武區 朝陽區豐台區 石景山區 海淀區門頭溝區 房山區通州區 順義區昌平區 大興區懷柔區 平谷區密雲縣 延慶縣愛知縣 神奈川 北海道和平區 河東區河西區 南開區河北區 紅橋區塘沽區 漢沽區大港區 東麗區...

Python獲取全國所有的省 市 縣 鎮 村

usr bin python3 coding utf 8 author he 通過國家統計局資料 獲取中國所有城市列表 獲取全國省份和直轄市 獲取省下級市 獲取市下級縣 縣下級鎮 鎮下級村 print 省 c citytr u url,he header,lists p print 市 o coun...

java android格式化字串

1 s string 1 d int 我今年 1 d歲了 string sageformat getresources getstring r.string.old string sfinalage string.format sageformat,23 將 1 d替換為23 1 d表達的意思是整個...