Skip to content

Instantly share code, notes, and snippets.

@alterakey
alterakey / gist:3871986
Created October 11, 2012 12:29
Simple JPP Example
// {"desc":"Description", "url":"http://host/path", "price":9999, "source":"XXX Shoppers"}
// -> Item (desc (String), url (String), price (long), source (String))
package com.gmail.altakey.xxx;
import android.util.Log;
import java.io.*;
import java.util.*;
import net.vvakame.util.jsonpullparser.*;
public class ItemStreamParser {
@alterakey
alterakey / repackage-acc-1.6-build.xml
Created November 10, 2012 01:18
Repackage Apache Commons Codec as org.apache.* -> com.apache.* with jarjar 1.4
<project name="jarjar">
<target name="package">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="jarjar-1.4.jar"/>
<jarjar jarfile="commons-codec-1.6-android.jar">
<zipfileset src="commons-codec-1.6.jar" />
<rule pattern="org.apache.**" result="com.apache.@1"/>
</jarjar>
</target>
</project>
@alterakey
alterakey / analyze.cfg
Created November 10, 2012 16:15
Pseudo-static API analysis strategy on Android
-injars bin/classes
-injars libs
-injars /path/to/android.jar
-outjars tmp.jar
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*
@alterakey
alterakey / map.txt
Created November 10, 2012 16:20
Experimental static API analysis report on Ellene
android.accessibilityservice.AccessibilityService -> android.accessibilityservice.AccessibilityService:
android.accounts.AccountAuthenticatorActivity -> android.accounts.AccountAuthenticatorActivity:
android.animation.Animator -> a:
android.animation.LayoutTransition -> b:
android.animation.ObjectAnimator -> c:
android.animation.ValueAnimator -> d:
android.app.ActionBar -> android.app.ActionBar:
android.app.ActionBar$LayoutParams -> android.app.ActionBar$LayoutParams:
android.app.Activity -> e:
int[] FOCUSED_STATE_SET -> a
@alterakey
alterakey / ClientActivity.java
Created November 14, 2012 12:21
Android NIO experiment
package com.gmail.altakey.nio;
import android.app.Activity;
import android.os.Bundle;
import android.os.AsyncTask;
import java.nio.*;
import java.nio.channels.SocketChannel;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@alterakey
alterakey / TwitterAuthService.java
Last active December 11, 2015 20:48
One-off, in-app, Twitter4j sign-on example
/*
* Copyright 2013 Takahiro Yoshimura
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@alterakey
alterakey / format.sh
Last active December 12, 2015 09:08
Script to use Eclipse formatter from the command line
#!/bin/sh
#
# Copyright 2013 Takahiro Yoshimura
#
# 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
#
@alterakey
alterakey / ArbitraryCursorLoader.java
Last active December 13, 2015 19:48
An experimental CursorLoader implementation, free from ContentProvider
/*
* Copyright (C) 2013 Takahiro Yoshimura <[email protected]>
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@alterakey
alterakey / android-jdb-attach.sh
Created March 3, 2013 15:43
Android debugger attacher
#!/bin/sh
pid="$1"
if test -z "$pid"; then
echo "usage: $0 <pid>"
echo "debuggable PIDs:"
adb jdwp
exit 1
fi
adb forward tcp:8600 jdwp:"$1"
rlwrap jdb -attach localhost:8600
@alterakey
alterakey / abe-java6.patch
Last active December 15, 2015 14:29
A quick patch to adapt the Android Backup Extractor ( https://github.com/nelenkov/android-backup-extractor ) to be run on Java SE 6 / Bouncy Castle 149
From e134c55979f63a48868189b82b5c1ac4ad03fd0a Mon Sep 17 00:00:00 2001
From: Takahiro Yoshimura <[email protected]>
Date: Fri, 13 Sep 2013 11:41:50 +0900
Subject: [PATCH] Porting to Java 6/BC-149
---
abe.sh | 6 +++---
build.xml | 4 ++--
src/org/nick/abe/AndroidBackup.java | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)