Ultimate String-Array List


Source link: https://github.com/vinaygaba/Ultimate-String-Array-List

Ultimate String-Array List

As an Android developer, I absolutely hate it when I have to worry about getting data for common use cases which involve things like list of countries, list of states or even letting the users enter their birth year. We see this in most android apps, especially the ones which have a form that a user needs to fill. Even if I do find the data , it is hardly in a format that I can use easily in my app. Honestly, this is 💩!

So I decided to do this 💩 work for you 😄! This repo will be a comprehensive list of common use cases like these with data in a format which is extremely easy to use in an Android app.

We have enough things to worry about as an Android developer and collecting data for common use cases shouldn't be one of them!

Current List of String-Arrays

The repository has the following list of string-array. Please note that this is continuously being updated so do check frequently. You can also send in your requests via the issue tracker. I am hoping that you take some inspiration from the categories I am adding and make contributions to this repo to make it more useful.

Name Description
App Categories.xml List of app categories present on the Google Play Store
Canada Province Codes.xml List of codes of provinces in Canada
Canada Provinces.xml List of provinces in Canada
China Province Codes.xml List of codes of provinces in China
China Provinces.xml List of provinces in China
Countries.xml List of all countries in the world
Country with telephonice codes.xml List of countries with their telephone codes.
Credit Card Networks.xml List of credit card networks
Cuisine.xml List of the different types of cuisines that people eat
Days of Month.xml List of days possible in a month
EPL Clubs.xml List of EPL Clubs(Season 14-15)
Gender.xml List of the possible gender options
Genre.xml List of the different genres of music
India Banks.xml List of all the banks running in India
India Top Cities.xml List of top cities in India
India State Codes.xml List of codes of States in India
India States.xml List of States in India
Months.xml List of all the possible months of a year
Moods.xml List of the different moods of people
Mumbai Localities.xml List of the localities of Mumbai
Olympic Countries.xml List of countries participating in the 2016 Olympics
Olympic Sports.xml List of the different sports being played in 2016 Olympics
Seasons.xml List of the possible season of a year
Sex.xml List of different sex categories (You have a disgusting mind 😄)
US State Codes.xml List of codes of States in the US
US States.xml List of States in the US
Weather.xml List of different weather conditions
Years.xml List of years from 1900 to 2050

Why String-Arrays?

String-Arrays are extremely flexible to use and it is very easy to use them in any data structure that we might like. Don't believe me? Fine let me prove it to you!

Copy the string array you want to use and place it in the res/values/some_file_name.xml file. It would look something like this:

<?xml version="1.0" encoding="utf-8"?> <resources>
  <string-array name="months">

<item>January</item>

.

.

.
  </string-array> </resources> 

Now to access this programmatically, we can do this:

//Get it in an array of strings String[] months = getResources().getStringArray(R.array.months);
  //Convert it into a list List<String> monthsList = new ArrayList<String>();

  list = Arrays.asList(months);

You can also combine these string arrays for use in your apps. Let's say I want a key-value pair with the state codes as the key and the state names as the value. To implement this, I can do the following:

String[] us_state_codes = getResources().getStringArray(R.array.us_state_codes);

String[] us_state = getResources().getStringArray(R.array.us_states);
  final Map<String, String> m = new HashMap<String, String>();
  for(int i=0;i<us_state_codes.length();
i++){

m.put(us_state_codes[i],us_states[i]);
 
}
 

As you can see, this is a really flexible way to access data and can be used in various scenarios.

Note: This is extremely basic stuff but I wanted to show these examples for people who have not worked with string-arrays before.

Contributing

Please use the issue tracker to report any discrepancies in the data or any string-arrays you would like to see.

For contributions to this repo, fell free to send a pull request.

Credits

Author: Vinay Gaba ( [email protected])

License

Copyright 2015 Vinay Gaba  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

Smart Fonts is an Android Studio Library which makes it easy to use Custom Fonts (TTF or OTF) in your apps. It handles the Android text widgets (TextView, EditText, CheckBox, RadioButton...). You can add any other widgets easily, including your own classes!

You can use Styles, and see the result directly in the Layout Editor!

A manager handles the caching of the fonts so that they are loaded only once. If a font is not used it is not loaded.

It is easy to integrate with gradle.

A pretty label layout.

Android project to experiment with various number of testing tools. It uses Java and Kotlin languages. Priority is given to fluency and ease of use. The idea is to provide a toolbox to write elegant and intelligible tests, with modern techniques like behavior-driven testing frameworks or fluent assertions.

Materially inspired widgets and views.

Just a simple library for Android that provides setting custom font on TextView from xml layout or Java class.

Observe Android's CONNECTIVITY_CHANGE broadcasts using RxJava.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes