"Android Open Source Library" app City selection

Source: Internet
Author: User

Citypicker

Now use more of the city selection interface like the American group and other apps.

2 steps can be achieved, it is so simple rough!

gifimageapk

Download the demo.apk experience.

Install

Gradle:

‘com.zaaach:citypicker:1.1‘

or Maven:

<dependency>  <groupId>com.zaaach</groupId> <artifactId>citypicker</artifactId> <version>1.1</version> <type>pom</type></dependency>

or download the Library manual import.

Usage

CityPickeritself has introduced the German Map positioning SDK.

Step1:

manifest.xmlAdd the key for the development platform application in your project

<meta-data android:name="com.amap.api.v2.apikey"           android:value="your key"/>

Also need to addCityPickerActivity

<activity            android:name="com.zaaach.citypicker.CityPickerActivity"            android:theme="@style/CityPicker.NoActionBar" android:screenOrientation="portrait" android:windowSoftInputMode="stateHidden|adjustPan"/>
Step2
PrivateStaticFinalint request_code_pick_city =0; //start Startactivityforresult (new Intent (MainActivity.this, Citypickeractivity.class), request_code_pick_city); //override Onactivityresult method  @Override  protected void onActivityResult< Span class= "Hljs-params" > (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); Resulttv.settext ( "current selection:" + City);}}         
STEP3:

Enjoy it.

Proguard

Attention confusion

//定位-keep class com.amap.api.location.**{*;}-keep class com.amap.api.fence.**{*;}-keep class com.autonavi.aps.amapapi.model.**{*;}
GitHub

GitHub Address: Citypicker Welcome star~



Bro0cl
Links: https://www.jianshu.com/p/b469c6f02754
Source: Pinterest
The copyright of the book is owned by the author, and any form of reprint should be contacted by the author for authorization and attribution.

"Android Open Source Library" app City selection

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.