Skip to content

Instantly share code, notes, and snippets.

View ralphpina's full-sized avatar

Ralph Pina ralphpina

  • Affirm
  • San Francisco, CA
View GitHub Profile
mmflogger E java.lang.RuntimeException: Could not dispatch event: class com.mapmyfitness.android.sensor.events.SensorErrorEvent to handler [EventHandler public void com.mapmyfitness.android
.activity.SensorConnectFragment.onSensorErrorEvent(com.mapmyfitness.android.sensor.events.SensorErrorEvent)]
17461 mmflogger E at com.squareup.otto.Bus.throwRuntimeException(Bus.java:456)
17461 mmflogger E at com.squareup.otto.Bus.dispatch(Bus.java:386)
17461 mmflogger E at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:367)
17461 mmflogger E at com.squareup.otto.Bus.post(Bus.java:336)
17461 mmflogger E at com.mapmyfitness.android.event.EventBus.post(EventBus.java:52)
17461 mmflogger E at com.mapmyfitness.android.event.EventBus$MyAsyncHandler.handleMessage(EventBus.java:72)
17461 mmflogger E at android.os.Handler.dispatchMessage(Handler.java:102)
17461
signingConfigs {
release {
storeFile file(“keystore_name.keystore”)
keyAlias “keystore_alias”
storePassword getPassword(‘ANDROID_KEYSTORE_PASSWORD’)
keyPassword getPassword(‘ANDROID_KEY_PASSWORD’)
}
}
// what package should Fragment belong to? I want to use it in Gingerbread!
public class MyFragment extends Fragment {
private TextView mTextView;
// Holding references to Activities is a no no.
// You are leaking its whole view hierarchy
private MyCallBack mMyCallBack;
// In fragments inflating views happens on onCreateView
@Override
@ralphpina
ralphpina / MainActivity.java
Created September 3, 2015 19:07
Sample Interview Activity
public class MainActivity extends AppCompatActivity {
private TextView _name;
private TextView _address;
private TextView _phoneNumber;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@ralphpina
ralphpina / RecyclerViewCursorAdapter.java
Created January 8, 2016 17:05
RecyclerView that wraps a Cursor.
package com.cotap.android.adapters;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.os.Handler;
import android.support.v7.widget.RecyclerView;
/**
machine:
environment:
TERM: "dumb"
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx5120m -XX:+HeapDumpOnOutOfMemoryError"'
ANDROID_HOME: /usr/local/android-sdk-linux
java:
version:
oraclejdk8
dependencies:
pre:
task incrementVersion << {
def propsFile = file("../gradle.properties")
def propsText = propsFile.getText()
def patternVersionNumber = Pattern.compile("app_version=(\\d+)\\.(\\d+)\\.(\\d+)")
def matcherVersionNumber = patternVersionNumber.matcher(propsText)
matcherVersionNumber.find()
def majorVersion = Integer.parseInt(matcherVersionNumber.group(1))
def minorVersion = Integer.parseInt(matcherVersionNumber.group(2))
public class TestComponentRule implements TestRule {
private ApplicationTestModule module;
private TestComponent testComponent;
private TestComponentRule(ApplicationTestModule applicationTestModule) {
this.module = applicationTestModule;
}
private void setupDaggerTestComponentInApplication() {
@ralphpina
ralphpina / BaseTest.java
Last active February 16, 2017 19:59
base test class
public class BaseTest {
public List<Giphy> getGiphies(int count) {
List<Giphy> list = new ArrayList<>();
for (int i = count; i > 0; i--) {
list.add(new Giphy.Builder().url("some_url_" + i).build());
}
return list;
}
}
@ralphpina
ralphpina / ActivityTestRule.java
Created February 16, 2017 20:04
instrumentation test rule example
public final TestComponentRule component = new TestComponentRule.Builder()
.withClient()
.withUserManager(true)
.build();
public final ActivityTestRule<MainActivity> activity = new ActivityTestRule<>(
MainActivity.class,
false,
false);