Skip to content

Instantly share code, notes, and snippets.

@beeender
beeender / MainActivity.java
Created December 28, 2015 07:06
Create Realm on external storage for Android M
package apptest.realm.io.androidmtest;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Environment;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
@janheinrichmerker
janheinrichmerker / SpanningGridLayoutManager.java
Last active September 16, 2025 22:06
GridLayoutManager implementation that stretches to fit all grid items on screen and disables scrolling. Useful for dashboards etc.
package com.example;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.ViewGroup;
public class SpanningGridLayoutManager extends GridLayoutManager {
@silmood
silmood / PostRequest.java
Last active March 9, 2018 17:16
Volley Singleton
RequestQueue queue = VolleyClient.getInstance(getActivity()).getRequestQueue(); //Obtain the instance
StringRequest volleyRequest = new StringRequest(Request.Method.POST,url, //Change the url parameter
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray jsonResponse = new JSONArray(response); // Convert string to JSONArray
//TODO: parse the JSON or whatever
@staltz
staltz / introrx.md
Last active March 21, 2026 07:17
The introduction to Reactive Programming you've been missing