Skip to content

Instantly share code, notes, and snippets.

Avatar

Flavien Laurent flavienlaurent

View GitHub Profile
@flavienlaurent
flavienlaurent / HttpRequestRetry.java
Last active Jan 2, 2016
How to retry request with http-request lib
View HttpRequestRetry.java
public interface HttpRequestBuilder {
public HttpRequest build();
}
HttpRequestBuilder builder = new HttpRequestBuilder {
@Override
public HttpRequest build() {
return HttpRequest.get("uri").acceptJson().userAgent("useragent");
}
}
@flavienlaurent
flavienlaurent / MainActivity.java
Last active Dec 28, 2015
Retrieve a String resource by name
View MainActivity.java
public class MainActivity extends ActionBarActivity {
private static final String TAG = "MainActivity";
private static final String SERVER_PREFIX = "SERVER_";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@flavienlaurent
flavienlaurent / DocumentsCursor.java
Last active Dec 27, 2015
Implementing a DocumentsProvier
View DocumentsCursor.java
import android.database.MatrixCursor;
import android.os.Bundle;
import android.provider.DocumentsContract;
public class DocumentsCursor extends MatrixCursor {
private Bundle mExtras;
public DocumentsCursor(String[] columnNames, int initialCapacity) {
super(columnNames, initialCapacity);
View installapk.bat
@echo off
adb install -r %1
pause;
View BoundBoxOfListFieldTestClassB.java
package org.boundbox.sample;
import java.lang.String;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import org.boundbox.BoundBoxException;
View MyCustomViewGroup.java
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
public class MyCustomViewGroup extends ViewGroup {
public MyCustomViewGroup(Context context) {
super(context);
// TODO Auto-generated constructor stub
View A.java
package thisisapackage;
import java.util.List;
public class A {
public void doIt(List<String> strings) {
// do it
}
}