Skip to content

Instantly share code, notes, and snippets.

View vedhavyas's full-sized avatar
🐧

Vedhavyas Singareddi vedhavyas

🐧
View GitHub Profile

Keybase proof

I hereby claim:

  • I am vedhavyas on github.
  • I am vedhavyas (https://keybase.io/vedhavyas) on keybase.
  • I have a public key whose fingerprint is F41E CDD3 DC96 7F1A AF2D 0308 BF62 2A66 FD4B 3589

To claim this, I am signing this object:

@vedhavyas
vedhavyas / PostExampleAndroid
Last active April 18, 2016 12:03
POST Request example in Android
//Add library by adding the following line in dependencies section in gradle file
compile 'com.squareup.okhttp3:okhttp:3.2.0'
//Making a Post request
OkHttpClient client = new OkHttpClient();
RequestBody body = new FormBody.Builder()
.add("name", "Name Here")
.add("email", "email here")
.add("purpose", "purpose here")
@vedhavyas
vedhavyas / FloatingService.java
Created April 10, 2016 12:07
Android Floating label
package com.instamojo.mink.services;
import android.animation.ValueAnimator;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.os.IBinder;
import android.view.Gravity;
@vedhavyas
vedhavyas / FetchUserPhoneNumber.java
Last active December 18, 2015 05:53
This code will fetch user phone number from contact card as well as accounts
private ArrayList<String> getOwnerPhone() {
ArrayList<String> numbers = new ArrayList<>();
getPhoneFromContacts(numbers);
getPhoneFromProfile(numbers);
return numbers;
}
private void getPhoneFromContacts(ArrayList<String> numbers) {
final AccountManager manager = AccountManager.get(this);
final Account[] accounts = manager.getAccountsByType("com.google");
@vedhavyas
vedhavyas / Attributes.java
Created November 28, 2014 08:44
Attribute combinations - A snippet to display the combinations of attributes
import java.util.Scanner;
public class Attributes{
public static void main(String [] args){
Scanner scanIN = new Scanner(System.in);
Scanner scanSTR = new Scanner(System.in);
String [] temp;
String str;
System.out.println("No. of attributes");
int numAtr = scanIN.nextInt();