Skip to content

Instantly share code, notes, and snippets.

View nishitpatel's full-sized avatar
🏠
Working from home

Nishit nishitpatel

🏠
Working from home
  • Kotak Securities Pvt. Ltd.
  • Navi Mumbai
View GitHub Profile
@nishitpatel
nishitpatel / Utility.m
Last active August 29, 2015 14:25
Objectice C common function which used in daily programming.
//Get UIColor from Hex color code
+(UIColor *)colorFromHexString:(NSString *)hexString {
unsigned rgbValue = 0;
NSScanner *scanner = [NSScanner scannerWithString:hexString];
[scanner setScanLocation:1]; // bypass '#' character
[scanner scanHexInt:&rgbValue];
return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
}
//Set Bottom Border to UITextField
@nishitpatel
nishitpatel / distancecoordinates
Created July 22, 2014 09:19
Find distance between two coordinates in km.
private float getDistanceBetweenCoordinates(double latitude1,
double longitude1, double latitude2, double longitude2) {
Location locationA = new Location("point A");
locationA.setLatitude(latitude1);
locationA.setLongitude(longitude1);
Location locationB = new Location("point B");
locationB.setLatitude(latitude2);
locationB.setLongitude(longitude2);
float meter = locationA.distanceTo(locationB);
@nishitpatel
nishitpatel / ContactListAdapter.java
Created July 8, 2014 10:36
Display List View in custom Dialog in android.
package com.vs2.sheduledsms.adpaters;
import java.util.ArrayList;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@nishitpatel
nishitpatel / ApplicationListAdpater
Created June 30, 2014 05:15
Create DBHelper,database Function and adapter class in android.
package com.vs2.applockfree.adapters;
import java.util.ArrayList;
import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@nishitpatel
nishitpatel / gist:e46b252f05b397929ba6
Created June 26, 2014 07:31
Handel Soft keyboard Go,Next,Done Text event.
edittext.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
// TODO Auto-generated method stub
if (actionId == EditorInfo.IME_ACTION_GO) {
//Do your task on go text click from keyboard
}
@nishitpatel
nishitpatel / ApplicationInformation
Last active August 29, 2015 14:02
Get Only Installed App List in Android
package com.vs2.applockfree.objects;
import java.util.ArrayList;
import java.util.List;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;