Tuesday, 18 August 2015

Android Templates And Utilities

source: https://github.com/petrnohejl/Android-Templates-And-Utilities

Android Templates And Utilities

Android Templates And Utilities is a collection of source codes, utilities, templates and snippets for Android development. It helps to build new apps and shows the best way how to implement certain problems on Android platform.
I write these templates for my personal need. I use it almost every day for developing apps. It is something like cookbook for me. All my apps are based on these templates.
In this repo you can find templates for styling action bar, working with alarm manager, communicating with server API, sending and receiving broadcasts, working with database, creating dialogs, using dual pane layout, fragments, GCM, geolocation, loading and caching images, working with intents, map, navigation drawer, showing notifications, preferences, running service, setting SSL connection, working with view pager, webview and much more. All templates were tested and should be compatible with Android 4+.
Android Templates And Utilities are organized into 3 groups:
  • Base - basic skelet of the Android project
  • Res - resource code including xml files, images
  • Src - source code including classes, resources


How to use these templates? Just copy the template into your project, rename package "com.example" to your own package name, rename classes' or resource's names if you want and customize the code to your needs. Some templates have /src/fragment/ExampleFragment.java class which demonstrates how to use the template in a Fragment.


Example of creating a basic app skelet with 1 Activity and 1 Fragment via Android Studio:
  • Create a new Android project with package name "com.example"
  • Copy & paste Base
  • Copy & paste Res-Placeholder
  • Copy & paste Res-Strings
  • Copy & paste Res-Theme
  • Copy & paste Src-Activity
  • Copy & paste Src-Application-Class
  • Copy & paste Src-Config
  • Copy & paste Src-Fragment
  • Copy & paste Src-Logcat
  • Copy & paste Src-NetworkUtility
  • Open ExampleActivity.java and comment out onCreateOptionsMenu(...) and onOptionsItemSelected(...) methods
  • Build the project and voilĂ , we have a basic skeleton for our future app

Developed by

No comments:

Post a Comment