This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code readability - 4 possibilities | |
// A | |
context.getContentResolver().update(getDownloadUri(context, intent), values, null, null); | |
// vs | |
// B | |
context.getContentResolver().update( | |
getDownloadUri(context, intent), values, null, null); | |
// vs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExampleActivity extends Activity implements WatchFaceLifecycle.Listener { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_my_layout); | |
WatchFaceLifecycle.attach(this, savedInstanceState, this); | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AdMobPokerExampleActivity extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
AdMobPoker.track(findViewById(R.id.adView), savedInstanceState); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.blundell.brittle.example"> | |
<application | |
android:allowBackup="true" | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name" | |
android:theme="@style/AppTheme"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.fest.assertions.api.Assertions.assertThat; | |
assertThat(intentOne).usingComparator(new IntentComparator()).isEqualTo(intentTwo); | |
private static class IntentComparator implements Comparator<Intent> { | |
@Override | |
public int compare(Intent left, Intent right) { | |
return left.filterEquals(right) ? 0 : 1; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.blundell.myapplication"> | |
<application> | |
<activity | |
android:name=".SecondActivity" | |
android:permission="perm.foo.bar" /> | |
</application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Vector<ContentValues> parseJson(String jsonStr) { | |
Vector<ContentValues> cVVector = new Vector<ContentValues>(); | |
try { | |
JSONObject json = new JSONObject(jsonStr); | |
JSONObject data = json.getJSONObject("data"); | |
JSONArray items = data.getJSONArray("items"); | |
for (int i = 0; i < items.length(); i++) { | |
// Get the JSON object representing the day | |
JSONObject videoDetails = items.getJSONObject(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity; | |
import android.app.Application; | |
import android.os.Bundle; | |
import java.util.Locale; | |
public class UniqueActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks { | |
private final String activityName; | |
private final Application.ActivityLifecycleCallbacks lifecycleCallbacks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.Executor; | |
import java.util.concurrent.Executors; | |
import kaaes.spotify.webapi.android.SpotifyApi; | |
import retrofit.android.MainThreadExecutor; | |
final class SpotifyApiBuilder { | |
private Executor executeExecutor; | |
private Executor callbackExecutor; |
OlderNewer