Skip to content

Instantly share code, notes, and snippets.

View mistrydarshan99's full-sized avatar

Darshan Mistry mistrydarshan99

View GitHub Profile
@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: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 / 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 };
<?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>