Skip to content

Instantly share code, notes, and snippets.

Yuriy Tim tim4dev

Block or report user

Report or block tim4dev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tim4dev
tim4dev / Dagger2SimpleExample.java
Created May 11, 2018 — forked from vestrel00/Dagger2SimpleExample.java
A: Dagger.android 2.11 simple example with support for Singleton, PerActivity, PerFragment, and PerChildFragment scopes
View Dagger2SimpleExample.java
// This is a super simplified example of how to use the new dagger.android framework
// introduced in Dagger 2.10. For a more complete, in-depth guide to dagger.android
// read https://proandroiddev.com/how-to-android-dagger-2-10-2-11-butterknife-mvp-part-1-eb0f6b970fd
// For a complete codebase using dagger.android 2.11/2.12/2.13/2.14, butterknife 8.7/8.8, and MVP,
// see https://github.com/vestrel00/android-dagger-butterknife-mvp
// This example works with Dagger 2.11/2.12/2.13/2.14. Starting with Dagger 2.11,
// @ContributesAndroidInjector was introduced removing the need to define @Subcomponent classes.
View gist:b3ff793d4c33f2ab7917deb650b3b5c3
05-02 12:24:45.009 10856 libc F Fatal signal 7 (SIGBUS), code 1, fault addr 0x1 in tid 10856 (FinalizerDaemon), pid 10840 (im4dev.imokhere)
05-02 12:24:45.405 10975 DEBUG F #00 pc 0000000000000001 <unknown>
05-02 12:24:45.405 10975 F #01 pc 000000000005b8d0 /system/lib64/libbinder.so (android::Parcel::freeDataNoInit()+64)
05-02 12:24:45.405 10975 F #02 pc 00000000001106bc /system/lib64/libandroid_runtime.so (android::android_os_Parcel_destroy(_JNIEnv*, _jclass*, long)+24)
05-02 12:24:45.405 10975 F #03 pc 0000000000612158 /system/framework/arm64/boot-framework.oat (offset 0x611000) (android.os.Binder.restoreCallingIdentity [DEDUPED]+152)
05-02 12:24:45.406 10975 F #04 pc 000000000054ae4c /system/lib64/libart.so (art_quick_invoke_static_stub+604)
05-02 12:24:45.406 10975 F #05 pc 00000000000dc5d0 /system/lib64/libart.so (art::ArtMethod::Invoke
View build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.test.test"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
View gist:e7b207ff85f1798bd10fe6f6b2f0514c
getObservablePhoneState()
.subscribe(integer -> Log.i(TAG, "onNext = " + stateToString(integer)));
private Observable<Integer> getObservablePhoneState() {
return Observable.create(emitter -> {
Log.i(TAG, "Started emitting");
View listener to observable
Observable
.interval(2, TimeUnit.SECONDS, Schedulers.io())
.map(time -> {
// ...
// get value
return val;
})
.subscribe(result -> ..., Throwable::printStackTrace);
@tim4dev
tim4dev / gist:aa586f26f22743bfc7a400a3e2d3f02d
Created Jul 11, 2017
UIAutomator instrumentation test crashed
View gist:aa586f26f22743bfc7a400a3e2d3f02d
package com.tim4dev.pkg1;
import android.app.UiAutomation;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.LargeTest;
You can’t perform that action at this time.