Skip to content

Instantly share code, notes, and snippets.

View mistrydarshan99's full-sized avatar

Darshan Mistry mistrydarshan99

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#fde0dc</color>
<color name="md_red_100">#f9bdbb</color>
<color name="md_red_200">#f69988</color>
@mistrydarshan99
mistrydarshan99 / image path
Created August 27, 2014 20:08
Get image path taken from camera
public Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
return Uri.parse(path);
}
private String getPath(Uri uri) {
String[] projection = { MediaStore.Images.Media.DATA };
@mistrydarshan99
mistrydarshan99 / gist:d74d550f0b81f47772ad
Created August 27, 2014 20:10
choose image from camera and gallery
private void selectImage() {
final CharSequence[] options = { "Take Photo", "Choose from Gallery","Cancel" };
AlertDialog.Builder builder = new AlertDialog.Builder(SignUp.this);
builder.setTitle("Add Photo!");
builder.setItems(options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
if (options[item].equals("Take Photo"))
@mistrydarshan99
mistrydarshan99 / gist:f107e6a77f36992f449a
Created August 27, 2014 20:22
how to use universal image loader
private DisplayImageOptions options;
public static ImageLoader imageLoader;
imageLoader = ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(activity));
options = new DisplayImageOptions.Builder().cacheOnDisc(true)
.showStubImage(R.drawable.ic_launcher)
.showImageOnFail(R.drawable.images).build();
@mistrydarshan99
mistrydarshan99 / gist:4bdfdeb4cb8f6cadb772
Created August 28, 2014 03:43
Http Get and Http Post class
package Backend;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;

#GDG Android in Berlin brainstorming session


On November 27, 2013 I was asking the brilliant Android developers at GDG Android in Berlin for their favorite libraries that make their lives easier and should be included in every newly developed app.

This is the list of libraries we collected during this 10 minute session.

Architecture

@mistrydarshan99
mistrydarshan99 / Makeup
Last active August 29, 2015 14:16 — forked from Trikke/Makeup
package trikke.gists;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.BackgroundColorSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
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
@mistrydarshan99
mistrydarshan99 / database
Created June 23, 2015 09:52
Android get Database file from internal device memory
/*** Dababase device ma thi bahar kadhva *****/
http://stackoverflow.com/questions/19194576/how-to-view-the-sqlite-database-in-device-android
1.)View Database filename :
=============================
adb -d shell "run-as com.yourpackge.name ls /data/data/com.yourpackge.name/databases/"
2.)Copy Database file to SDCard :
public class ColoredSnackBar {
private static final int red = 0xfff44336;
private static final int green = 0xff4caf50;
private static final int blue = 0xff2195f3;
private static final int orange = 0xffffc107;
private static View getSnackBarLayout(Snackbar snackbar) {
if (snackbar != null) {