Skip to content

Instantly share code, notes, and snippets.

View charlieCollins's full-sized avatar

Charlie Collins charlieCollins

View GitHub Profile
@charlieCollins
charlieCollins / Installataion.java
Created October 23, 2013 20:58
Android Installation (unique ID per install)
public class Installation {
private static String sID;
private static final String INSTALLATION = "INSTALLATION";
// Usage: Just call Installation.id(this) from Application class onCreate and store in "session" (whatever you use for small temp in mem).
public synchronized static String id(Context context) {
if (Installation.sID == null) {
File installation = new File(context.getFilesDir(), Installation.INSTALLATION);
try {
@charlieCollins
charlieCollins / WebViewTest
Created January 30, 2013 15:06
WebView test/example for 4.2.1.
package com.totsp.webviewtest;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
@charlieCollins
charlieCollins / gist:4447502
Last active December 10, 2015 14:28
Android two thread (main and back) examples for review.
//
// EXAMPLE METHOD 1
//
// member var
private final Looper backLooper; // background looper, only used here internally
//inside onCreate or ctor, etc
HandlerThread thread = new HandlerThread("BackLooper", Thread.NORM_PRIORITY);
thread.start();
@charlieCollins
charlieCollins / gist:2690512
Created May 13, 2012 22:29 — forked from jedi4ever/gist:903751
Tuning stuff for Ubuntu hosts
# /etc/security/limits.conf
* soft nofile 999999
* hard nofile 999999
root soft nofile 999999
root hard nofile 999999
===========================================================
# /etc/sysctl.conf
# sysctl for maximum tuning
@charlieCollins
charlieCollins / PlasticLinearLayout.java
Created October 6, 2011 20:32
Eric Burke's PlasticLinearLayout
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import com.movl.swipeit.R;