Skip to content

Instantly share code, notes, and snippets.

@Gopinathp
Gopinathp / AnyActivity.java
Created October 10, 2012 05:30
On any typical android activity, in which you want to have copy app private files to sdcard, wire the Common.java code to handle the file copying
private static final int MENU_COPY_FILES = 99;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_kid_feed, menu);
if (BuildConfig.DEBUG) {
menu.add(Menu.NONE, MENU_COPY_FILES, Menu.NONE, "Copy App Files to sdcard");
}
return true;
}
@Gopinathp
Gopinathp / GLogger.java
Created October 10, 2012 05:15
A wrapper around the Android logger which can skip debug logs on production builds automatically.
package com.tringtringlabs.mykidstory.components;
/**
* @author gopinath
* A wrapper around the regular Android logger which will disable debug logs in production automatically.
*/
import android.util.Log;
import com.tringtringlabs.mykidstory.App;
import com.tringtringlabs.mykidstory.BuildConfig;
@Gopinathp
Gopinathp / Common.java
Created October 10, 2012 05:07
copy Android app's private files to sdcard
package com.tringtringlabs.experiments;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import android.app.Activity;
@Gopinathp
Gopinathp / Common.java
Created September 20, 2012 10:32
A public static method to figure out 50 Friends with Android phones and send them apprequests
public static void fbShareThisAppForAndroidUsers(final Facebook mFacebook, final Activity mActivity) {
AsyncTask<Object, Object, Object> asyncTask = new AsyncTask<Object, Object, Object>() {
private WeakReference<Activity> weakActivity;
private Facebook facebook;
@Override
protected Object doInBackground(Object... params) {
try {
facebook = mFacebook;