Skip to content

Instantly share code, notes, and snippets.

View smuldr's full-sized avatar

Steven Mulder smuldr

View GitHub Profile
@smuldr
smuldr / EditTextMatchers.java
Created June 30, 2015 11:58
Espresso: Match EditText error text
package smuldr.espresso.util;
import android.content.res.Resources;
import android.support.test.espresso.matcher.BoundedMatcher;
import android.view.View;
import android.widget.EditText;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
@smuldr
smuldr / activity_main.xml
Created June 15, 2015 08:25
Android NavigationView below Toolbar
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
@smuldr
smuldr / gist:6221823
Last active December 21, 2015 00:39
How to make sure the SenseApi returns a sensor ID for your own device.
try {
String deviceUuid = SenseApi.getDefaultDeviceUuid(this);
SenseApi.getSensorId(this, "name", null, null, deviceUuid);
} catch (IOException e) {
// TODO: Handle exception when connection failed
} catch (JSONException e) {
// TODO: Handle exception when response was unparsable
}
import nl.sense_os.service.commonsense.SenseApi;
public class Foo extends Activity {
/**
* Sends a JSON object to /foo/bar at CommonSense API and checks the response
*/
public void foo() {
String urlString = "https://api.sense-os.nl/foo/bar";