Shortify for Android

Android Arsenal API

Shortify is used for minimizing your coding effort in your development environment. It has some builtin method and classes which helps you in creating mostly used element and tasks in Android app.


Grab library via Gradle

compile 'net.dhruvpatel:shortify:1.2.4'

or Maven



How to use

Initialize library before using it in onCreate method


Binding of any views

// Basic 
EditText editText = (EditText) context.findViewById(;
com.example.view.CustomView customView = (com.example.view.CustomView) context.findViewById(;

// Shortify
EditText editText = $.bind(;
com.example.view.CustomView customView = $.bind(;

Binding of resources

// Basic 
String str = getApplicationContext().getString(R.string.app_name);
Drawable drawable = getApplicationContext().getDrawable(R.drawable.example);
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.animation1);

// Shortify
String str           = $.bindString(R.string.app_name);
Drawable drawable    = $.bindDrawable(R.drawable.example);
Animation animation  = $.bindAnimation(R.anim.animation1);
//List of binders

Customize views

TextView textView = (TextView) findViewById(;
Linkify.addLinks(textView, Linkify.ALL);


Parsing JSON data

Shortify can parse long and complex JSON data in simplest way. You can parse any type of data like integer, long, double, boolean, String

int value = $.getIntFromJSON(path, JSON_STRING);
String str = $.getStringFromJSON(path, JSON_STRING);
long value = $.getLongFromJSON(path, JSON_STRING);
double value = $.getDoubleFromJSON(path, JSON_STRING);;
boolean value = $.getBooleanFromJSON(path, JSON_STRING);

Example 1

     "$schema": "",
     "title": "Product",
     "description": "A product from Acme's catalog",
     "type": "object",
     "properties": {
         "id": {
             "description": "The unique identifier for a product",
             "type": "integer"
         "name": {
             "description": "Name of the product",
             "type": "string"
         "price": {
             "type": "number",
             "minimum": 0,
             "exclusiveMinimum": true
         "tags": {
             "type": "array",
             "items": {
                 "type": "string"
             "minItems": 1,
             "uniqueItems": true
     "required": ["id", "name", "price"]
  1. Now suppose we want to get value of properties > price > minimum

    int value = $.getStringFromJSON("properties.price.minimum", JSON_STRING);
  2. Suppose we want to get value of properties > tags > items > type

    String value = $.getStringFromJSON("properties.tags.items.type", JSON_STRING);
  3. If we want to get 2nd element of required object

    String value = $.getStringFromJSON("required[1]", JSON_STRING);

    Example 2

    This example has array of user and no object is assigned to whole array

       "first": "first name 1",
       "last": "last name 1"
       "month": "January",
       "day": 1
       "first": "first name 2",
       "last": "last name 2"
       "month": "May",
       "day": 2

    Now suppose we want to get value of 1st user's first name

    String name = $.getStringFromJSON("[0].name.first", JSON_STRING);


Shortify enables you to send AJAX request to server via both GET and POST method and it can also retrive response from webpage

GET method

$.httpGet("", new AJAX.AJAXCallback() {
   public void onComplete(String response) {
       Log.d(TAG, response);

POST method

HashMap<String, Object> queryStringData = new HashMap<>();

$.httpPost("",queryStringData,  new AJAX.AJAXCallback() {
   public void onComplete(String response) {
       Log.d(TAG, response);

Event handlers

Button button = (Button) findViewById(;
button.setOnClickListener(new View.OnClickListener() {
    public void onClick(View view) {

$.id( Task() {
    public void perform() {


//Simple alert dialog box

//Generates and shows dialog with OK button with onClick event handlers
$.confirmDialog("Title", "Description", new Click() {
    public void ok() {


//Generates and shows dialog with YES and NO button with onClick event handlers
$.yesNoDialog("Title", "Description", new Agree() {
    public void yes() {


    public void no() {


Other functions

//Check, if app is installed or not in device 

//Open current or any other app page in Play store app

//Showing toast

//Get current date and time in any format
$.time("d m y");

//Check app permission (used for Runntime Permission Model)

//Navigate to any activity with or without passing data
$.open(Activity.class, bundle);

Apps using Shortify for Android

Slefie Flashlight Selfie Flashlight
Material Music Player Material Music Player

Ping me for adding your app in this list

Thanks for using. if you have any suggestions or bug report please create new issue here