RepoPilotOpen in app →

amitshekhariitbhu/RxJava2-Android-Samples

RxJava 2 Android Examples - How to use RxJava 2 in Android

Healthy

Healthy across all four use cases

weakest axis
Use as dependencyHealthy

Permissive license, no critical CVEs, actively maintained — safe to depend on.

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture — runnable as-is.

  • Last commit 3mo ago
  • 14 active contributors
  • Apache-2.0 licensed
Show all 7 evidence items →
  • Tests present
  • Slowing — last commit 3mo ago
  • Concentrated ownership — top contributor handles 78% of recent commits
  • No CI workflows detected

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Healthy" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Healthy
[![RepoPilot: Healthy](https://repopilot.app/api/badge/amitshekhariitbhu/rxjava2-android-samples)](https://repopilot.app/r/amitshekhariitbhu/rxjava2-android-samples)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/amitshekhariitbhu/rxjava2-android-samples on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: amitshekhariitbhu/RxJava2-Android-Samples

Generated by RepoPilot · 2026-05-09 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/amitshekhariitbhu/RxJava2-Android-Samples shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

GO — Healthy across all four use cases

  • Last commit 3mo ago
  • 14 active contributors
  • Apache-2.0 licensed
  • Tests present
  • ⚠ Slowing — last commit 3mo ago
  • ⚠ Concentrated ownership — top contributor handles 78% of recent commits
  • ⚠ No CI workflows detected

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live amitshekhariitbhu/RxJava2-Android-Samples repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/amitshekhariitbhu/RxJava2-Android-Samples.

What it runs against: a local clone of amitshekhariitbhu/RxJava2-Android-Samples — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in amitshekhariitbhu/RxJava2-Android-Samples | Confirms the artifact applies here, not a fork | | 2 | License is still Apache-2.0 | Catches relicense before you depend on it | | 3 | Default branch master exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 130 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>amitshekhariitbhu/RxJava2-Android-Samples</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of amitshekhariitbhu/RxJava2-Android-Samples. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/amitshekhariitbhu/RxJava2-Android-Samples.git
#   cd RxJava2-Android-Samples
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of amitshekhariitbhu/RxJava2-Android-Samples and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "amitshekhariitbhu/RxJava2-Android-Samples(\\.git)?\\b" \\
  && ok "origin remote is amitshekhariitbhu/RxJava2-Android-Samples" \\
  || miss "origin remote is not amitshekhariitbhu/RxJava2-Android-Samples (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(Apache-2\\.0)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"Apache-2\\.0\"" package.json 2>/dev/null) \\
  && ok "license is Apache-2.0" \\
  || miss "license drift — was Apache-2.0 at generation time"

# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
  && ok "default branch master exists" \\
  || miss "default branch master no longer exists"

# 4. Critical files exist
test -f "app/src/main/java/com/rxjava2/android/samples/MyApplication.java" \\
  && ok "app/src/main/java/com/rxjava2/android/samples/MyApplication.java" \\
  || miss "missing critical file: app/src/main/java/com/rxjava2/android/samples/MyApplication.java"
test -f "app/src/main/java/com/rxjava2/android/samples/ui/SelectionActivity.java" \\
  && ok "app/src/main/java/com/rxjava2/android/samples/ui/SelectionActivity.java" \\
  || miss "missing critical file: app/src/main/java/com/rxjava2/android/samples/ui/SelectionActivity.java"
test -f "app/src/main/java/com/rxjava2/android/samples/ui/operators/SimpleExampleActivity.java" \\
  && ok "app/src/main/java/com/rxjava2/android/samples/ui/operators/SimpleExampleActivity.java" \\
  || miss "missing critical file: app/src/main/java/com/rxjava2/android/samples/ui/operators/SimpleExampleActivity.java"
test -f "app/src/main/java/com/rxjava2/android/samples/ui/compose/RxSchedulers.java" \\
  && ok "app/src/main/java/com/rxjava2/android/samples/ui/compose/RxSchedulers.java" \\
  || miss "missing critical file: app/src/main/java/com/rxjava2/android/samples/ui/compose/RxSchedulers.java"
test -f "app/src/main/java/com/rxjava2/android/samples/ui/rxbus/RxBus.java" \\
  && ok "app/src/main/java/com/rxjava2/android/samples/ui/rxbus/RxBus.java" \\
  || miss "missing critical file: app/src/main/java/com/rxjava2/android/samples/ui/rxbus/RxBus.java"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 130 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~100d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/amitshekhariitbhu/RxJava2-Android-Samples"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

A comprehensive Android reference app demonstrating RxJava 2 operators and patterns through 50+ runnable example Activities. It shows how to use Observable, Flowable, Subject types (BehaviorSubject, PublishSubject, ReplaySubject, AsyncSubject), caching strategies, multi-source composition, and networking integration with rx2-android-networking. Single Android app module (app/) structured by feature: ui/operators/ contains ~20 operator demo Activities, ui/cache/ shows three-tier caching (MemoryDataSource → DiskDataSource → NetworkDataSource), ui/compose/ demonstrates operator composition, ui/networking/ shows HTTP integration. Models live in model/ (User, ApiUser, Car, Events). RxSchedulers utility in compose/ centralizes threading.

👥Who it's for

Android developers migrating from RxJava 1.x to 2.x, or learning reactive programming for the first time. Also useful as a teaching resource for teams adopting reactive patterns in Android apps.

🌱Maturity & risk

Active reference project with stable RxJava 2.2.2 / RxAndroid 2.1.0 dependencies. Targets SDK 28 with Java 8 features enabled. No CI/CD pipeline visible in file list, minimal test coverage (only JUnit 4.12 listed), and no recent commit dates provided—appears to be a maintained but not heavily updated educational resource rather than a production library.

Low production risk since this is explicitly a learning/examples repo, not a library. Single maintainer (Amit Shekhar). RxJava 2.2.2 (from 2016–2018 era) is stable but not actively receiving updates; no Kotlin support shown. Dependencies are minimal and well-vetted (RxJava, RxAndroid, FastAndroidNetworking). No evidence of active issue triage or PR merging.

Active areas of work

No active development signals in provided metadata. Repo appears to be a static reference—designed to teach, not actively evolve. No open PRs, milestones, or recent commits mentioned.

🚀Get running

Check README for instructions.

Daily commands: Android Studio: File → Open → select repo root → Gradle sync → Run on emulator/device. Or: ./gradlew assembleDebug && adb install app/build/outputs/apk/debug/app-debug.apk then launch the app.

🗺️Map of the codebase

  • app/src/main/java/com/rxjava2/android/samples/MyApplication.java — Application entry point and context initialization for RxJava setup.
  • app/src/main/java/com/rxjava2/android/samples/ui/SelectionActivity.java — Main navigation hub that routes to all example activities—essential for understanding the sample structure.
  • app/src/main/java/com/rxjava2/android/samples/ui/operators/SimpleExampleActivity.java — Foundational RxJava example demonstrating Observable creation and subscription patterns.
  • app/src/main/java/com/rxjava2/android/samples/ui/compose/RxSchedulers.java — Central scheduler configuration for thread management across all RxJava operations.
  • app/src/main/java/com/rxjava2/android/samples/ui/rxbus/RxBus.java — Event bus implementation using RxJava2—a key architectural pattern used throughout samples.
  • app/src/main/java/com/rxjava2/android/samples/utils/ObserverAdapter.java — Reusable observer wrapper for handling subscriptions consistently across activities.
  • app/build.gradle — Dependency configuration and RxJava2 library versions required for all samples.

🛠️How to make changes

Add a New Operator Example

  1. Create a new Activity extending AppCompatActivity in app/src/main/java/com/rxjava2/android/samples/ui/operators/ (app/src/main/java/com/rxjava2/android/samples/ui/operators/YourOperatorExampleActivity.java)
  2. Create corresponding layout XML in app/src/main/res/layout/ (app/src/main/res/layout/activity_your_operator_example.xml)
  3. Implement the operator logic using RxJava2 Observables, following the pattern in SimpleExampleActivity.java (app/src/main/java/com/rxjava2/android/samples/ui/operators/YourOperatorExampleActivity.java)
  4. Register the activity in AndroidManifest.xml and add menu item to SelectionActivity.java (app/src/main/AndroidManifest.xml)

Add a New Network Data Source

  1. Create a new DataSource implementation in app/src/main/java/com/rxjava2/android/samples/ui/cache/source/ following DataSource.java interface (app/src/main/java/com/rxjava2/android/samples/ui/cache/source/YourDataSource.java)
  2. Define return types using model classes in app/src/main/java/com/rxjava2/android/samples/model/ or create new model as needed (app/src/main/java/com/rxjava2/android/samples/model/YourModel.java)
  3. Use RxJava2 Observable.create() or fromCallable() to wrap network calls, referencing NetworkDataSource.java pattern (app/src/main/java/com/rxjava2/android/samples/ui/cache/source/YourDataSource.java)
  4. Integrate schedulers via RxSchedulers.java for IO and Main thread handling (app/src/main/java/com/rxjava2/android/samples/ui/compose/RxSchedulers.java)

Add a New Event Type to RxBus

  1. Create a new event model class in app/src/main/java/com/rxjava2/android/samples/model/ (app/src/main/java/com/rxjava2/android/samples/model/YourEvent.java)
  2. Post events via RxBus.getInstance().post(yourEvent) from any activity or service (app/src/main/java/com/rxjava2/android/samples/ui/rxbus/RxBus.java)
  3. Subscribe to events in target activity using RxBus.getInstance().toObservable(YourEvent.class).subscribe(...) (app/src/main/java/com/rxjava2/android/samples/ui/rxbus/RxBusActivity.java)

🪤Traps & gotchas

RxJava 2.x has breaking changes from 1.x (no Observable.from() for iterables, checked exceptions in Observables). Subscriptions in Activities must be disposed in onDestroy() or Fragments' onDestroyView() to avoid memory leaks (see DisposableExampleActivity). Schedulers.io() is unbounded—high-volume sources need Flowable with backpressure (see FlowableExampleActivity). The repo targets SDK 28 but declares minSdkVersion 16, requiring API level guards if using newer APIs. No provided test utilities or instrumentation tests—examples are meant to be run manually.

💡Concepts to learn

  • Reactive Streams Specification — RxJava 2.0 was rewritten to comply with Reactive Streams (backpressure, demand-driven pull) replacing the RxJava 1.x ad-hoc model. Understanding Publisher/Subscriber contract explains why Flowable exists alongside Observable.
  • Backpressure (Flowable vs Observable) — Flowable handles upstream sources emitting faster than subscribers can consume (databases, files, network streams). Observable has no backpressure mechanism. FlowableExampleActivity demonstrates when to use each.
  • Subjects (Hot Observable Multicasting) — PublishSubject, BehaviorSubject, ReplaySubject, AsyncSubject are 'hot' (emit regardless of subscribers). Critical for UI state management, event buses, and bridging imperative-to-reactive code. Examples show when to replay vs. drop events.
  • Scheduler (Thread Management) — RxJava is single-threaded by default. Schedulers.io(), Schedulers.computation(), AndroidSchedulers.mainThread() determine which thread operators run on. RxSchedulers.java centralizes this; wrong scheduler choice causes ANRs or race conditions.
  • Operator Composition (Fluent Chain) — RxJava's power lies in chaining operators (map → filter → reduce → subscribe). ComposeOperatorExampleActivity shows how intermediate operators build complex data transformations declaratively.
  • Memory Leak via Disposable — Subscriptions (Disposable) must be cleaned up in onDestroy()/onDestroyView(), else Activity/Fragment holds strong refs to data sources, leaking memory. DisposableExampleActivity explicitly shows this anti-pattern and fix.
  • Repository Pattern (Three-Tier Caching) — CacheExampleActivity's MemoryDataSource → DiskDataSource → NetworkDataSource exemplifies repository pattern in Android: check fast store first, fall through to slow store, populate caches on load. Critical for offline-first UX.
  • ReactiveX/RxJava — Official RxJava library this project depends on (v2.2.2). Needed to understand operator internals and breaking changes from 1.x.
  • ReactiveX/RxAndroid — RxAndroid 2.1.0 extension library providing AndroidSchedulers.mainThread() and Lifecycle-aware subscription helpers used throughout examples.
  • google/architecture-samples — Google's equivalent reference project for Android architecture patterns (MVVM, Jetpack); shows modern Kotlin + Flow alternatives to RxJava.
  • square/retrofit — Popular HTTP client often paired with RxJava 2 for network requests. This repo uses rx2-android-networking as alternative but Retrofit + RxJava is industry standard.
  • amitshekhariitbhu/Android-Debug-Database — Another educational project by same author showing database inspection patterns; complements caching examples in this repo.

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add unit tests for RxBus event broadcasting and subscription pattern

The RxBus.java is a critical utility for event communication across the app, but there are no unit tests. Given this is an educational repo about RxJava 2, demonstrating proper testing patterns for RxBus (subscription, event emission, unsubscription, memory leaks) would be highly valuable for contributors learning RxJava testing.

  • [ ] Create app/src/test/java/com/rxjava2/android/samples/ui/rxbus/RxBusTest.java
  • [ ] Add tests for event publishing and subscription (verify subscribers receive events)
  • [ ] Add tests for unsubscription and cleanup (prevent memory leaks)
  • [ ] Add tests for multiple subscribers receiving same event
  • [ ] Verify tests run with JUnit 4 and Mockito (already in testImplementation)
  • [ ] Add example test output to demonstrate RxBus testing patterns for educational purposes

Add instrumented tests for cache layer (MemoryDataSource, DiskDataSource, NetworkDataSource)

The cache module (app/src/main/java/com/rxjava2/android/samples/ui/cache/source/) demonstrates a real-world pattern of tiered data sources, but has zero tests. Adding androidTests would demonstrate proper testing of RxJava Observable chains with multiple data sources, cache prioritization, and fallback patterns - essential knowledge for learners.

  • [ ] Create app/src/androidTest/java/com/rxjava2/android/samples/ui/cache/source/CacheDataSourceTest.java
  • [ ] Test MemoryDataSource returns data without network calls
  • [ ] Test DiskDataSource fallback when memory cache misses
  • [ ] Test NetworkDataSource fallback when disk cache misses
  • [ ] Test the composed cache strategy (memory → disk → network) with proper Observable chaining
  • [ ] Verify proper disposable management to prevent memory leaks in cache operations

Add integration test example for PaginationActivity demonstrating RxJava pagination patterns

The PaginationActivity.java and PaginationAdapter.java implement a common real-world pattern (infinite scroll with RxJava), but lack tests showing how to test pagination logic, page concatenation, and proper backpressure handling. This is a high-value educational example for contributors.

  • [ ] Create app/src/androidTest/java/com/rxjava2/android/samples/ui/pagination/PaginationActivityTest.java
  • [ ] Add test verifying initial page load triggers correct API call
  • [ ] Add test for pagination: verify page 2 loads when scrolling near bottom
  • [ ] Add test for Flowable backpressure handling (since pagination deals with streaming data)
  • [ ] Add test preventing duplicate page requests on rapid scrolls
  • [ ] Add test verifying proper disposal of pagination subscriptions on Activity destroy

🌿Good first issues

  • Add unit tests for operators in app/src/test/ (currently only functional/manual examples exist). Start with MapExampleActivity logic using JUnit + MockitoTestObserver from RxJava.
  • Create a dedicated example Activity for Kotlin interop (app targets Java 8 but lacks Kotlin examples). Show how to use RxKotlin extensions (flatMapSequence, etc.) alongside Java patterns.
  • Document the three-tier caching strategy in CacheExampleActivity with sequence diagrams and comment the source selection logic (MemoryDataSource.onNext → fallback to DiskDataSource). Currently underdocumented.

Top contributors

Click to expand

📝Recent commits

Click to expand
  • 74693e2 — Update README.md (amitshekhariitbhu)
  • feaaf21 — Delete .github directory (amitshekhariitbhu)
  • a22bb87 — Update README.md (amitshekhariitbhu)
  • 32432ed — Update README.md (amitshekhariitbhu)
  • a7d4dc7 — Update README.md (amitshekhariitbhu)
  • 0e1c933 — Update README.md (amitshekhariitbhu)
  • 60994e4 — Update README.md (amitshekhariitbhu)
  • 05a5123 — Update README.md (amitshekhariitbhu)
  • 3652b49 — Update README.md (amitshekhariitbhu)
  • 21f6e7f — Update README.md (amitshekhariitbhu)

🔒Security observations

  • High · Outdated Dependencies with Known Vulnerabilities — app/build.gradle - dependencies section. The project uses outdated versions of RxJava2 (2.2.2), RxAndroid (2.1.0), and AndroidX libraries (1.0.0-rc02) from 2018-2019. These versions contain multiple known security vulnerabilities and bugs. RxJava 2.2.2 has known CVEs related to security issues that were patched in later versions. Fix: Update to the latest stable versions: RxJava2 (2.2.11+), RxAndroid (2.1.1+), and AndroidX libraries to their latest stable releases. Regularly audit dependencies using tools like OWASP Dependency-Check or Snyk.
  • High · Outdated Compile and Target SDK Version — app/build.gradle - compileSdkVersion and targetSdkVersion. The project targets SDK 28 (Android 9, released 2018) which is significantly outdated. Current minimum should be SDK 31+ and target 34+. Using outdated SDKs means missing critical security patches, privacy controls, and modern security features. Fix: Update compileSdkVersion and targetSdkVersion to at least 34 (Android 14). This ensures access to latest security patches, privacy features, and Google Play Store compliance.
  • Medium · Minification Disabled in Release Builds — app/build.gradle - release buildType. The release build configuration has minifyEnabled set to false, which means the code is not obfuscated. This makes reverse engineering easier and exposes internal implementation details, API endpoints, and sensitive logic. Fix: Enable minification by setting minifyEnabled to true and ensure proper ProGuard/R8 configuration in proguard-rules.pro to protect sensitive code and reduce app size.
  • Medium · Deprecated Testing Dependencies — app/build.gradle - androidTestImplementation entries. The project uses outdated espresso-core (3.1.0-alpha4) and test runner versions (1.1.0-alpha4) from 2018. Alpha versions should never be used in production; they lack stability and security updates. Fix: Update to stable versions: androidx.test.espresso:espresso-core (3.5.1+), androidx.test:runner (1.5.2+), and androidx.test:rules (1.5.0+).
  • Medium · Deprecated AppCompat and RecyclerView Libraries — app/build.gradle - implementation androidx.appcompat and androidx.recyclerview. Using AndroidX 1.0.0-rc02 (release candidate from 2018) instead of stable versions. These outdated libraries may contain security vulnerabilities and performance issues that were fixed in subsequent releases. Fix: Update to latest stable versions: androidx.appcompat:appcompat (1.6.1+) and androidx.recyclerview:recyclerview (1.3.2+).
  • Medium · Third-party Networking Library with Potential Vulnerabilities — app/build.gradle - implementation of rx2-android-networking. The project uses com.amitshekhar.android:rx2-android-networking:1.0.2 (from 2018). This third-party library is outdated and may have unpatched security vulnerabilities. There's no evidence of maintained updates. Fix: Evaluate if this library is still maintained. Consider migrating to modern alternatives like OkHttp + Retrofit or Android built-in HttpURLConnection with proper certificate pinning and security practices.
  • Low · Minimum SDK Version Too Low — app/build.gradle - minSdkVersion. minSdkVersion is set to 16 (Android 4.1, 2012). This increases the attack surface by supporting very old, unpatched Android versions with numerous known vulnerabilities. Fix: Raise minSdkVersion to at least 24 (Android 7.0+) to drop support for obsolete, vulnerable Android versions. Modern Google Play Store recommends API 31+.
  • Low · Missing Security Configuration Files — undefined. No evidence of network_security_config.xml for Certificate Pinning or proper TLS configuration, missing proguard rules for sensitive classes, and Fix: undefined

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Healthy signals · amitshekhariitbhu/RxJava2-Android-Samples — RepoPilot