Android 城市选择,热门城市,全部城市(美团、滴滴、淘宝)

https://pan.baidu.com/s/12r_5rG4XbaTlD2soxdLBPA

完整项目链接

https://pan.baidu.com/s/12r_5rG4XbaTlD2soxdLBPA


导入module


调用

CityPickerActivity

startActivityForResult(new Intent(MainActivity.this, CityPickerActivity.class),
        REQUEST_CODE_PICK_CITY);

private static final int REQUEST_CODE_PICK_CITY = 0;

    //返回选中城市
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == REQUEST_CODE_PICK_CITY && resultCode == RESULT_OK){
            if (data != null){
                String city = data.getStringExtra(CityPickerActivity.KEY_PICKED_CITY);
//                if (!city.equals("全国")) {
//                    city += "市";
//                }
                button.setText(city);
            }
        } else {

        }
    }

猜你喜欢

转载自blog.csdn.net/meixi_android/article/details/80076065